/* ============================================================================
   PLI ROTERIZADOR - DESIGN SYSTEM
   Colors: Verde #3ec26e | Azul #1c3d59
   Framework: Flexbox + CSS Grid
   ============================================================================ */

:root {
  /* PLI Colors - MANDATORY */
  --sigma-verde: #3ec26e;      /* PLI green accent */
  --sigma-verde-forte: #4ade80; /* PLI green — sidebar / destaque */
  --sigma-azul: #1c3d59;       /* PLI navy */
  --sigma-primary: #003b5a;    /* PLI deep blue (dark background) */
  --sigma-secondary: #1c3d59;  /* PLI navy */
  --sigma-accent: #116593;     /* PLI blue medium (buttons, links) */
  --sigma-success: #2aa358;    /* PLI dark green */
  --sigma-warning: #f39c12;    /* Yellow */
  --sigma-error: #c0392b;      /* Red */
  --sigma-info: #116593;       /* PLI blue */
  
  /* Neutral colors */
  --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;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  
  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Poppins', sans-serif;
}

/* ============================================================================
   RESET & BASE STYLES
   ============================================================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  /* Escala global - reduz tudo proporcionalmente (rem-based) */
  font-size: 11.7px;
}

@media (min-width: 1600px) {
  html { font-size: 12.6px; }
}

body {
  font-family: var(--font-sans);
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.6;
  overflow: hidden;
  display: flex;
  height: 100vh;
}

a {
  color: var(--sigma-accent);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--sigma-verde);
}

/* ============================================================================
   LAYOUT PRINCIPAL
   ============================================================================ */

body {
  display: flex;
  flex-direction: row;
}

.sidebar {
  background: var(--sigma-primary);
  color: white;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  transition: width 0.3s ease, transform 0.3s ease;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-left {
  width: 368px;
  position: relative;
  --sb-text: #ffffff;
  --sb-placeholder: rgba(255, 255, 255, 0.38);
  --sb-muted: rgba(255, 255, 255, 0.58);
  --sb-green: var(--sigma-verde-forte);
  color: var(--sb-text);
}

/* Scrollbar discreta na sidebar */
.sidebar,
.sidebar-nav {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.14) transparent;
}

.sidebar::-webkit-scrollbar,
.sidebar-nav::-webkit-scrollbar {
  width: 5px;
}

.sidebar::-webkit-scrollbar-track,
.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb,
.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.sidebar:hover::-webkit-scrollbar-thumb,
.sidebar-nav:hover::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
}

.sidebar-right {
  width: 300px;
  border-right: none;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* ============================================================================
   SIDEBAR HEADER
   ============================================================================ */

.sidebar-header {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  height: 6rem;
  min-height: 6rem;
  flex-shrink: 0;
  padding: 1rem 1.1rem;
  border-bottom: 3px solid var(--sigma-verde);
  background: linear-gradient(135deg, var(--sigma-primary) 0%, var(--sigma-secondary) 100%);
  text-decoration: none;
  color: inherit;
  transition: opacity 0.15s ease;
}

.sidebar-header:hover {
  opacity: 0.92;
}

.logo-container {
  width: 100%;
  text-align: center;
}

.logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  /* Mesma marca do PLI Hub: icone em verde institucional, nome em branco.
     Antes o nome tambem vinha verde. */
  color: #fff;
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.3px;
  line-height: 1.1;
  white-space: nowrap;
}

.logo-icon {
  display: inline-flex;
  width: 1.08em;
  height: 1.08em;
  flex-shrink: 0;
  color: var(--sigma-verde);
}

.logo-icon svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.logo-sub {
  margin: 0.28rem 0 0;
  padding: 0 0.1rem;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.805rem;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================================================
   SIDEBAR NAVIGATION
   ============================================================================ */

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 0;
}

.nav-section {
  padding: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.nav-section:last-child {
  border-bottom: none;
}

.nav-title {
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--sb-green);
  font-weight: 700;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ============================================================================
   FORM ELEMENTS
   ============================================================================ */

.form-group {
  margin-bottom: 1rem;
}

.type-selector-fieldset {
  margin: 0 0 1rem;
  padding: 0;
  border: 0;
  min-width: 0;
}

.type-selector-fieldset .field-legend {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--sb-text);
  margin-bottom: 0.5rem;
  padding: 0;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--sb-text);
  margin-bottom: 0.5rem;
}

.form-group input {
  width: 100%;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0.5rem;
  color: var(--sb-text);
  font-size: 0.875rem;
  font-family: var(--font-sans);
  transition: all 0.2s ease;
}

.form-group input::placeholder {
  color: var(--sb-placeholder);
  opacity: 1;
}

.form-group input:placeholder-shown {
  color: var(--sb-placeholder);
}

.form-group input:not(:placeholder-shown) {
  color: var(--sb-text);
  font-weight: 500;
}

.form-group input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--sigma-verde);
  box-shadow: 0 0 0 3px rgba(62, 194, 110, 0.1);
}

/* ============================================================================
   BUTTONS
   ============================================================================ */

.btn {
  padding: 0.75rem 1.25rem;
  border: none;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  font-family: var(--font-sans);
}

.btn-primary {
  background: linear-gradient(135deg, var(--sigma-verde-forte) 0%, var(--sigma-verde) 100%);
  color: white;
  box-shadow: var(--shadow-md);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--sigma-verde);
}

.btn-close {
  background: none;
  border: none;
  color: var(--gray-600);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
}

.btn-close:hover {
  color: var(--gray-900);
}

/* ============================================================================
   CHECKBOXES
   ============================================================================ */

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  padding: 0.75rem 0;
  user-select: none;
  transition: color 0.2s ease;
}

.checkbox-group:hover {
  color: var(--sigma-verde);
}

.checkbox-group input[type="checkbox"] {
  width: 1.25rem;
  height: 1.25rem;
  cursor: pointer;
  accent-color: var(--sigma-verde);
}

.checkbox-group span {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.9);
}

/* ============================================================================
   SIDEBAR FOOTER
   ============================================================================ */

.sidebar-footer {
  padding: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.2);
  text-align: center;
}

.sidebar-footer p {
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--sb-muted);
}

.sidebar-footer strong {
  color: rgba(255, 255, 255, 0.88);
  font-weight: 600;
}

.admin-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.625rem;
  font-size: 0.6875rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.35);
  transition: color 0.2s;
  letter-spacing: 0.3px;
}

.admin-link:hover {
  color: var(--sigma-verde);
}

/* ============================================================================
   APP HEADER
   ============================================================================ */

.app-header {
  height: 6rem;
  min-height: 6rem;
  flex-shrink: 0;
  background: #155d31;
  border-bottom: 1px solid rgba(0, 0, 0, 0.25);
  padding: 0.6rem 1.25rem;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  box-shadow: var(--shadow-sm);
  z-index: 50;
  position: relative;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-self: start;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-self: end;
}

.app-header h2 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: white;
  font-weight: 700;
  letter-spacing: 1px;
  text-align: center;
  text-transform: uppercase;
  justify-self: center;
  margin: 0;
  /* Mesma marca do PLI Hub: icone em verde institucional, nome em branco. */
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.app-header h2 .app-header-icon {
  flex-shrink: 0;
  width: 1.15em;
  height: 1.15em;
  color: var(--sigma-verde);
}

.toggle-sidebar {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: white;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  border-radius: 0.25rem;
}

.toggle-sidebar:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* ============================================================================
   MAP CONTAINER
   ============================================================================ */

.map-container {
  flex: 1;
  background: var(--gray-100);
  position: relative;
  overflow: hidden;
}

#map {
  width: 100%;
  height: 100%;
  z-index: 10;
}

/* Leaflet overrides */
.leaflet-container {
  font-family: var(--font-sans);
}

/* Opção A: seta padrão no mapa; pan continua com clique+arrasto */
.leaflet-container.leaflet-grab,
.leaflet-container.leaflet-dragging,
.leaflet-grab,
.leaflet-dragging .leaflet-container {
  cursor: default;
}

.route-click-mode,
.route-click-mode .leaflet-container,
.route-click-mode .leaflet-interactive {
  cursor: crosshair !important;
}

.leaflet-control-zoom {
  border: none;
  box-shadow: var(--shadow-md);
}

.leaflet-control-zoom a {
  background: white;
  color: var(--sigma-primary);
  border: 1px solid var(--gray-200);
  font-weight: 600;
}

.leaflet-control-zoom a:first-child {
  border-bottom: 1px solid var(--gray-200);
}

.leaflet-control-zoom a:hover {
  background: var(--gray-50);
}

/* ============================================================================
   INFO PANEL
   ============================================================================ */

.info-panel {
  position: absolute;
  width: 360px;
  max-width: calc(100% - 2rem);
  background: white;
  border-radius: 0.75rem;
  box-shadow: var(--shadow-xl);
  z-index: 200;
  animation: slideUp 0.3s ease;
  left: auto;
  top: auto;
  right: auto;
  bottom: auto;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(1rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.info-panel.hidden,
.info-panels-root.hidden {
  display: none;
}

.info-panels-root {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 200;
}

.info-panels-root .info-panel {
  pointer-events: auto;
}

.info-panel.is-dragging {
  z-index: 210;
  animation: none;
}

.info-header--draggable {
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.info-panel.is-dragging .info-header--draggable {
  cursor: grabbing;
}

.info-panel-conv {
  z-index: 200;
}

.info-panel-smart {
  z-index: 201;
}

.info-header-smart {
  background: linear-gradient(135deg, #1a5c38 0%, var(--sigma-verde) 100%);
}

.info-header .info-mode-badge {
  margin-left: auto;
  margin-right: 0.5rem;
}

.diagnostic-summary {
  font-size: 0.9rem;
  color: var(--gray-700);
  margin-bottom: 0.75rem;
  line-height: 1.45;
}

.diagnostic-category {
  margin-bottom: 1rem;
}

.diagnostic-category-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--sigma-primary);
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.diagnostic-subcategory-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gray-800);
  margin: 0.5rem 0 0.35rem;
}

.diagnostic-layer-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.diagnostic-layer-item {
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.45rem;
  background: var(--gray-50);
  border-radius: 0.5rem;
  border-left: 3px solid var(--sigma-secondary);
  font-size: 0.82rem;
  line-height: 1.45;
}

.diagnostic-layer-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  margin-bottom: 0.45rem;
}

.diagnostic-layer-sev {
  margin-left: 0;
  order: -1;
}

.diagnostic-layer-title {
  display: block;
  color: var(--gray-900);
  font-size: 0.88rem;
  line-height: 1.3;
}

.diagnostic-layer-metrics {
  color: var(--gray-700);
}

.diagnostic-metric-line {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  margin-bottom: 0.35rem;
}

.diagnostic-metric-line:last-child {
  margin-bottom: 0;
}

.diagnostic-metric-label {
  font-size: 0.72rem;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.diagnostic-metric-value {
  font-weight: 600;
  color: var(--gray-800);
}

.diagnostic-metric-hint {
  font-size: 0.75rem;
  color: var(--gray-500);
  margin-top: 0.15rem;
}

.diagnostic-empty {
  font-size: 0.82rem;
  color: var(--gray-500);
  font-style: italic;
  padding: 0.25rem 0;
}

/* Resumo de exposição — barras segmentadas por camada HazardTrack */
.exposure-summary {
  margin-bottom: 0.25rem;
}

.exposure-summary-title {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gray-500);
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.exposure-hazard-group-title {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--gray-800);
  margin: 0 0 0.85rem;
  line-height: 1.35;
}

.exposure-summary-group {
  margin-bottom: 1rem;
}

.exposure-summary-group:last-child {
  margin-bottom: 0;
}

.exposure-layer-bars {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.exposure-layer-bar-block {
  text-align: center;
}

.exposure-layer-bar-track {
  position: relative;
  height: 28px;
  width: 100%;
  background: #bfdbfe;
  border-radius: 6px;
  overflow: hidden;
}

.exposure-layer-bar-fill {
  position: relative;
  height: 100%;
  display: flex;
  align-items: stretch;
  border-radius: 6px 0 0 6px;
  overflow: hidden;
  min-width: 52px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.exposure-layer-bar-seg {
  height: 100%;
  flex-shrink: 0;
}

.exposure-layer-bar-pct {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.72rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
  pointer-events: none;
  white-space: nowrap;
  z-index: 2;
}

.exposure-layer-bar-name {
  margin-top: 0.4rem;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--gray-700);
  line-height: 1.3;
}

.exposure-layer-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem 0.65rem;
  margin-top: 0.45rem;
}

.exposure-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.62rem;
  color: var(--gray-500);
}

.exposure-legend-swatch {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}

.exposure-empty {
  font-size: 0.8rem;
  color: var(--gray-500);
  font-style: italic;
  text-align: center;
  padding: 0.35rem 0;
  margin: 0;
}

.route-smart-notice p {
  margin: 0 0 0.45rem;
}

.route-smart-notice p:last-child {
  margin-bottom: 0;
}

.route-critical-alert,
.popup-critical-alert,
.diagnostic-layer-alert {
  margin-top: 0.65rem;
  padding: 0.65rem 0.75rem;
  background: rgba(192, 57, 43, 0.1);
  border: 1px solid rgba(192, 57, 43, 0.45);
  border-left: 4px solid #c0392b;
  border-radius: 0.45rem;
  font-size: 0.78rem;
  color: #7f1d1d;
  line-height: 1.45;
  font-weight: 600;
}

.popup-critical-alert {
  margin-top: 0.5rem;
}

.diagnostic-layer-item--critical {
  border-left: 3px solid #c0392b;
  padding-left: 0.5rem;
}

.diagnostic-layer-alert {
  margin-top: 0.45rem;
  font-weight: 600;
}

.auto-smart-notice {
  --notice-color: #c0392b;
  margin-top: 0.75rem;
  padding: 0.65rem 0.75rem;
  background: color-mix(in srgb, var(--notice-color) 14%, white);
  border: 1px solid color-mix(in srgb, var(--notice-color) 52%, white);
  border-left: 4px solid var(--notice-color);
  border-radius: 0.5rem;
  font-size: 0.8rem;
  color: var(--gray-800);
  line-height: 1.4;
}

.smart-selection-notice {
  margin-top: 0.75rem;
  padding: 0.65rem 0.75rem;
  background: #fff7ed;
  border: 1px solid #fdba74;
  border-left: 4px solid #ea580c;
  border-radius: 0.5rem;
  color: #7c2d12;
  font-size: 0.8rem;
  line-height: 1.4;
}

.smart-selection-notice p {
  margin: 0 0 0.45rem;
}

.smart-selection-notice p:last-child {
  margin-bottom: 0;
}

.smart-result-modal {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(2px);
}

.smart-result-modal.hidden {
  display: none;
}

.smart-result-modal-card {
  width: min(38rem, calc(100vw - 2rem));
  padding: 1.2rem;
  border: 1px solid #fdba74;
  border-top: 5px solid #ea580c;
  border-radius: 0.75rem;
  background: #fff;
  color: #431407;
  box-shadow: 0 1.25rem 3rem rgba(15, 23, 42, 0.3);
}

.smart-route-options {
  display: grid;
  gap: 0.65rem;
  max-height: min(55vh, 28rem);
  margin-top: 0.9rem;
  overflow-y: auto;
}

.smart-route-option {
  padding: 0.75rem;
  border: 1px solid #cbd5e1;
  border-left: 4px solid #16a34a;
  border-radius: 0.55rem;
  background: #f8fafc;
}

.smart-route-option h4 {
  margin: 0 0 0.45rem;
  color: #14532d;
  font-size: 0.88rem;
}

.smart-route-option-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.3rem 0.75rem;
  color: #475569;
  font-size: 0.75rem;
}

.smart-route-option button {
  display: block;
  margin: 0.65rem auto 0;
  padding: 0.42rem 1rem;
  border: 0;
  border-radius: 0.4rem;
  background: #15803d;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.smart-result-modal-card h3 {
  margin: 0 0 0.7rem;
  text-align: center;
  color: #9a3412;
  font-size: 1rem;
}

.smart-result-modal-card p {
  margin: 0;
  color: #7c2d12;
  font-size: 0.85rem;
  line-height: 1.5;
}

.smart-result-modal-actions {
  display: flex;
  justify-content: center;
  margin-top: 1rem;
}

.smart-result-modal-actions button {
  min-width: 6.5rem;
  padding: 0.5rem 1.2rem;
  border: 0;
  border-radius: 0.45rem;
  background: #0f5f78;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.analysis-export-bar {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.analysis-export-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 700;
  color: var(--sigma-primary);
}

.analysis-export-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.analysis-export-btn {
  flex: 1;
  min-width: 4.5rem;
  padding: 0.4rem 0.65rem;
  border: 1px solid var(--gray-300);
  border-radius: 0.4rem;
  background: white;
  color: var(--gray-800);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.analysis-export-btn:hover {
  background: var(--gray-50);
  border-color: var(--sigma-secondary);
  color: var(--sigma-primary);
}

/* ============================================================================
   PDF — PARECER TÉCNICO (exportação html2pdf)
   Largura fixa em px: html2canvas não interpreta bem mm/grid com opacity 0.
   ============================================================================ */

.analysis-pdf-root {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 2147483646;
  width: 794px;
  min-width: 794px;
  max-width: 794px;
  background: #f8fafc;
  color: #1e293b;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  box-sizing: border-box;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.analysis-pdf-root.analysis-pdf-capturing {
  left: 0;
  top: 0;
  opacity: 1;
  pointer-events: none;
}

.analysis-pdf-root.analysis-pdf-hidden {
  opacity: 0;
  z-index: -1;
  pointer-events: none;
}

.analysis-pdf-doc {
  width: 794px;
  min-width: 794px;
  max-width: 794px;
  box-sizing: border-box;
  background: #ffffff;
  overflow: hidden;
}

/* Capa / cabeçalho institucional */
.pdf-cover {
  display: table;
  width: 100%;
  table-layout: fixed;
  padding: 28px 32px;
  background: linear-gradient(135deg, #003b5a 0%, #1c3d59 55%, #116593 100%);
  color: #ffffff;
  box-sizing: border-box;
}

.pdf-cover-left,
.pdf-cover-right {
  display: table-cell;
  vertical-align: middle;
}

.pdf-cover-right {
  text-align: right;
  width: 48%;
}

.pdf-brand {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.pdf-brand-mark {
  font-family: 'Poppins', sans-serif;
  font-size: 2.4rem;
  font-weight: 700;
  color: #3ec26e;
  line-height: 1;
  letter-spacing: -1px;
}

.pdf-brand-name {
  font-family: 'Poppins', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.92);
}

.pdf-cover-org {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.72);
  max-width: 220px;
  line-height: 1.4;
  margin: 8px 0 0;
}

.pdf-doc-eyebrow {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: #3ec26e;
  margin: 0;
}

.pdf-doc-title {
  font-family: 'Poppins', sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.25;
  color: #ffffff;
}

.pdf-mode-badge {
  display: inline-block;
  margin-top: 0.35rem;
  padding: 0.3rem 0.85rem;
  border-radius: 2rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.pdf-mode-badge.mode-convencional {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #ffffff;
}

.pdf-mode-badge.mode-smart {
  background: #3ec26e;
  border: 1px solid #2aa358;
  color: #ffffff;
}

/* Faixa de metadados */
.pdf-meta-strip {
  display: table;
  width: 100%;
  table-layout: fixed;
  background: #f1f5f9;
  border-bottom: 3px solid #3ec26e;
}

.pdf-meta-item {
  display: table-cell;
  width: 25%;
  padding: 14px 18px;
  border-right: 1px solid #e2e8f0;
  vertical-align: top;
}

.pdf-meta-item:last-child {
  border-right: none;
}

.pdf-meta-label {
  display: block;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #64748b;
  margin-bottom: 3px;
}

.pdf-meta-value {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #003b5a;
  word-break: break-word;
}

/* Introdução */
.pdf-intro {
  padding: 20px 32px 10px;
  box-sizing: border-box;
}

.pdf-intro p {
  margin: 0;
  font-size: 0.88rem;
  color: #475569;
  line-height: 1.65;
  text-align: justify;
  border-left: 4px solid #116593;
  padding-left: 1rem;
}

/* KPIs — flex com largura fixa (html2canvas não renderiza grid bem) */
.pdf-kpi-grid {
  display: flex;
  flex-wrap: nowrap;
  width: 100%;
  gap: 10px;
  padding: 16px 32px 20px;
  box-sizing: border-box;
}

.pdf-kpi-card {
  flex: 1 1 0;
  min-width: 0;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 14px 12px;
  border-top: 3px solid #116593;
  box-sizing: border-box;
}

.pdf-kpi-card.pdf-kpi-accent {
  border-top-color: #3ec26e;
  background: linear-gradient(180deg, rgba(62, 194, 110, 0.08) 0%, #f8fafc 100%);
}

.pdf-kpi-card.pdf-kpi-alert {
  border-top-color: #c0392b;
  background: linear-gradient(180deg, rgba(192, 57, 43, 0.06) 0%, #f8fafc 100%);
}

.pdf-kpi-label {
  display: block;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #64748b;
  margin-bottom: 0.25rem;
}

.pdf-kpi-value {
  display: block;
  font-family: 'Poppins', sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: #003b5a;
  line-height: 1.1;
}

.pdf-kpi-unit {
  display: block;
  font-size: 0.68rem;
  color: #94a3b8;
  margin-top: 0.15rem;
}

/* Exposição e recomendação */
.pdf-exposure-block {
  padding: 0 32px 24px;
  box-sizing: border-box;
}

.pdf-section {
  padding: 0 32px 24px;
  box-sizing: border-box;
}

.pdf-section-title {
  font-family: 'Poppins', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: #003b5a;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid #3ec26e;
}

.pdf-section-desc {
  font-size: 0.78rem;
  color: #64748b;
  margin: -0.35rem 0 1rem;
}

.pdf-risk-meter {
  width: 100%;
  height: 1.1rem;
  background: #e2e8f0;
  border-radius: 1rem;
  overflow: hidden;
  margin-bottom: 0.65rem;
}

.pdf-risk-bar {
  height: 100%;
  background: linear-gradient(90deg, #2aa358 0%, #f39c12 50%, #c0392b 100%);
  border-radius: 1rem;
  min-width: 2px;
}

.pdf-summary-text {
  font-size: 0.85rem;
  color: #334155;
  margin: 0 0 1rem;
  line-height: 1.55;
}

.pdf-callout {
  padding: 0.85rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.82rem;
  line-height: 1.5;
}

.pdf-callout strong {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.pdf-callout p {
  margin: 0;
}

.pdf-callout-ok {
  background: rgba(62, 194, 110, 0.12);
  border: 1px solid rgba(62, 194, 110, 0.35);
  color: #1e4d32;
}

.pdf-callout-warn {
  background: rgba(243, 156, 18, 0.12);
  border: 1px solid rgba(243, 156, 18, 0.4);
  color: #7d4e00;
}

/* Cards de camada (espelham o popup) */
.pdf-subsection {
  margin-bottom: 1.25rem;
}

.pdf-subsection-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: #1c3d59;
  margin: 0 0 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.pdf-layer-grid {
  display: flex;
  flex-wrap: wrap;
  width: 100%;
  gap: 10px;
}

.pdf-layer-card {
  flex: 0 0 48%;
  width: 48%;
  box-sizing: border-box;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-left: 4px solid #116593;
  border-radius: 8px;
  padding: 12px 14px;
  break-inside: avoid;
  page-break-inside: avoid;
}

.pdf-layer-card-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
  margin-bottom: 0.4rem;
}

.pdf-layer-card-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
  line-height: 1.3;
}

.pdf-layer-card-cat {
  font-size: 0.68rem;
  color: #64748b;
  margin: 0 0 0.45rem;
}

.pdf-layer-metrics {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.pdf-layer-metric-label {
  display: block;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: #94a3b8;
}

.pdf-layer-metric-value {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #1e293b;
}

.pdf-sev-pill {
  display: inline-block;
  padding: 0.12rem 0.55rem;
  border-radius: 1rem;
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.35px;
  white-space: nowrap;
}

/* Tabela anexo */
.pdf-annex {
  padding-bottom: 2rem;
}

.pdf-data-table {
  width: 100%;
  max-width: 730px;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 10px;
  word-wrap: break-word;
}

.pdf-data-table thead tr {
  background: linear-gradient(135deg, #003b5a 0%, #1c3d59 100%);
  color: #ffffff;
}

.pdf-data-table th {
  padding: 0.55rem 0.5rem;
  text-align: left;
  font-weight: 700;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border: 1px solid #003b5a;
}

.pdf-data-table td {
  padding: 0.45rem 0.5rem;
  border: 1px solid #e2e8f0;
  vertical-align: top;
  color: #334155;
}

.pdf-row-even {
  background: #ffffff;
}

.pdf-row-odd {
  background: #f8fafc;
}

.pdf-td-num,
.pdf-td-center {
  text-align: center;
}

.pdf-td-mono {
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 0.65rem;
  color: #475569;
}

.pdf-empty,
.pdf-empty-cell {
  font-style: italic;
  color: #94a3b8;
  text-align: center;
  padding: 1rem;
}

/* Rodapé */
.pdf-footer {
  display: table;
  width: 100%;
  table-layout: fixed;
  padding: 16px 32px 24px;
  margin-top: 16px;
  border-top: 2px solid #e2e8f0;
  background: #f8fafc;
  box-sizing: border-box;
}

.pdf-footer-brand {
  display: table-cell;
  vertical-align: bottom;
  width: 75%;
}

.pdf-footer-mark {
  display: block;
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 0.78rem;
  color: #003b5a;
}

.pdf-footer-sub {
  display: block;
  font-size: 0.62rem;
  color: #94a3b8;
  margin-top: 0.15rem;
  max-width: 28rem;
}

.pdf-footer-page {
  display: table-cell;
  vertical-align: bottom;
  text-align: right;
  font-size: 10px;
  font-weight: 600;
  color: #64748b;
  font-family: 'Consolas', monospace;
}

.pdf-page-break-before {
  page-break-before: always;
  break-before: page;
}

.info-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--gray-200);
  background: linear-gradient(135deg, var(--sigma-primary) 0%, var(--sigma-secondary) 100%);
  border-radius: 0.75rem 0.75rem 0 0;
  color: white;
}

.info-header h3 {
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.2;
}

.info-header .btn-close {
  width: 1.5rem;
  height: 1.5rem;
  font-size: 1.25rem;
}

/* Maximizar e fechar: mesmo alvo e mesma cor, sobre o cabecalho escuro. */
.info-header .btn-close,
.info-header .btn-expand {
  color: #fff;
  opacity: 0.85;
}

.info-header .btn-close:hover,
.info-header .btn-expand:hover {
  color: #fff;
  opacity: 1;
}

.info-header .btn-expand {
  background: none;
  border: none;
  padding: 0;
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.info-header .btn-expand svg {
  width: 0.95rem;
  height: 0.95rem;
}

/*
 * Maximizado: o painel sai do fluxo dos painéis lado a lado e ocupa a janela.
 * As coordenadas inline vindas do arraste sao limpas ao maximizar e
 * restauradas ao voltar, senao brigariam com o position: fixed.
 */
.info-panel--maximized {
  position: fixed;
  inset: 1rem;
  width: auto;
  max-width: none;
  height: auto;
  z-index: 1200;
  display: flex;
  flex-direction: column;
}

.info-panel--maximized .info-content {
  flex: 1 1 auto;
  max-height: none;
  overflow-y: auto;
}

.info-panel--maximized .info-header--draggable {
  cursor: default;
}

.info-content {
  padding: 1.25rem;
  max-height: 400px;
  overflow-y: auto;
}

.info-item {
  margin-bottom: 1rem;
}

.info-item label,
.info-item-label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--sigma-primary);
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.info-item p {
  font-size: 1rem;
  color: var(--gray-900);
  font-weight: 500;
}

.info-item ul {
  list-style: none;
  font-size: 0.875rem;
}

.info-item li {
  padding: 0.5rem 0;
  color: var(--gray-600);
  border-bottom: 1px solid var(--gray-100);
}

.info-item li:last-child {
  border-bottom: none;
}

/* ============================================================================
   RISK METER
   ============================================================================ */

.risk-meter {
  width: 100%;
  height: 1.5rem;
  background: var(--gray-200);
  border-radius: 1rem;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.risk-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--sigma-success) 0%, var(--sigma-warning) 50%, var(--sigma-error) 100%);
  transition: width 0.3s ease;
  border-radius: 1rem;
}

/* ============================================================================
   UTILITIES
   ============================================================================ */

.divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 1rem 0;
}

.text-muted {
  color: var(--sb-muted, rgba(255, 255, 255, 0.58));
}

.sidebar-left .text-muted {
  color: var(--sb-muted);
}

.small {
  font-size: 0.75rem;
  line-height: 1.4;
}

.hidden {
  display: none;
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */

@media (max-width: 1200px) {
  .sidebar-left {
    width: 322px;
  }
}

@media (max-width: 768px) {
  body {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    max-height: 50vh;
  }

  .sidebar-left {
    display: none;
    position: absolute;
    left: 0;
    top: 0;
    height: 100vh;
    width: 100%;
    z-index: 1000;
  }

  .sidebar-left.active {
    display: flex;
  }

  .main-content {
    height: 100%;
  }

  .info-panel {
    width: calc(100% - 2rem);
    max-width: calc(100% - 2rem);
  }

  .app-header h2 {
    font-size: 1rem;
  }

  /*
   * Em tela estreita a legenda cobria quase todo o mapa. Fica limitada a uma
   * faixa do canvas e o usuario recolhe pelo proprio botao quando precisar de
   * mais area. O rotulo do acesso restrito nao quebra mais em duas linhas.
   */
  .map-layer-legend {
    max-width: min(15rem, calc(100% - 1.5rem));
    max-height: 38vh;
    font-size: 0.68rem;
  }

  .header-admin-link {
    white-space: nowrap;
  }
}

@media (max-width: 480px) {
  .sidebar-left {
    width: 100%;
  }

  .app-header {
    padding: 0.75rem;
  }

  .app-header h2 {
    font-size: 0.875rem;
  }

  .info-panel {
    width: calc(100% - 1rem);
    max-width: calc(100% - 1rem);
  }

  .map-layer-legend {
    left: 0.5rem;
    bottom: 0.5rem;
    max-width: calc(100% - 1rem);
    max-height: 32vh;
  }

  .header-admin-link {
    padding: 0.3rem 0.5rem;
    font-size: 0.62rem;
    gap: 0.3rem;
  }
}


/* ============================================================================
   TABS - MODO DE ENTRADA
   ============================================================================ */

.tabs {
  display: flex;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 0.5rem;
  padding: 0.25rem;
  margin-bottom: 1rem;
  gap: 0.25rem;
}

.tab-btn {
  flex: 1;
  padding: 0.5rem 0.5rem;
  background: transparent;
  border: none;
  color: var(--sb-muted);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 0.375rem;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-family: var(--font-sans);
}

.tab-btn:hover {
  color: var(--sb-text);
  background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
  background: var(--sb-green);
  color: var(--sb-text);
  box-shadow: 0 2px 8px rgba(74, 222, 128, 0.35);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================================
   TYPE SELECTOR (Cidade / Endereco / CEP)
   ============================================================================ */

.type-selector {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 0.5rem;
}

.type-btn {
  flex: 1;
  padding: 0.5rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--sb-text);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 0.375rem;
  transition: all 0.2s ease;
  font-family: var(--font-sans);
}

.type-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
}

.type-btn.active {
  background: var(--sb-green);
  color: var(--sb-text);
  border-color: var(--sb-green);
}

/* ============================================================================
   SEARCH WRAPPER + AUTOCOMPLETE
   ============================================================================ */

.search-wrapper {
  position: relative;
}

.search-wrapper input[type="text"] {
  width: 100%;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0.5rem;
  color: var(--sb-text);
  font-size: 0.875rem;
  font-family: var(--font-sans);
  transition: all 0.2s ease;
}

.search-wrapper input[type="text"]::placeholder {
  color: var(--sb-placeholder);
  opacity: 1;
}

.search-wrapper input[type="text"]:placeholder-shown {
  color: var(--sb-placeholder);
}

.search-wrapper input[type="text"]:not(:placeholder-shown) {
  color: var(--sb-text);
  font-weight: 500;
}

.search-wrapper input[type="text"]:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--sigma-verde);
  box-shadow: 0 0 0 3px rgba(62, 194, 110, 0.15);
}

.search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: white;
  border-radius: 0.5rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  max-height: 240px;
  overflow-y: auto;
  z-index: 1000;
}

.search-result-item {
  padding: 0.75rem;
  cursor: pointer;
  border-bottom: 1px solid var(--gray-100);
  transition: background 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.search-result-item:hover {
  background: var(--gray-50);
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item strong {
  color: var(--sigma-primary);
  font-size: 0.875rem;
  font-weight: 600;
}

.search-result-item span {
  color: var(--gray-600);
  font-size: 0.75rem;
  line-height: 1.3;
}

.search-feedback {
  font-size: 0.75rem;
  color: var(--sb-muted);
  margin-top: 0.375rem;
}

.search-feedback.success {
  color: var(--sb-green);
  font-weight: 500;
}

.info-box {
  background: rgba(17, 101, 147, 0.15);
  border-left: 3px solid var(--sigma-accent);
  padding: 0.75rem;
  border-radius: 0.375rem;
  font-size: 0.8rem;
  color: var(--sb-muted);
  line-height: 1.5;
  margin-bottom: 1rem;
}

.click-status {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.status-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.5rem 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 0.375rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.status-label {
  font-size: 0.7rem;
  color: var(--sb-green);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
}

.status-value {
  font-size: 0.85rem;
  color: var(--sb-muted);
  font-family: 'Courier New', monospace;
}

.status-value.has-value {
  color: var(--sb-text);
  font-weight: 600;
}

/* ============================================================================
   BOTAO PRINCIPAL DESTACADO
   ============================================================================ */

.btn-main {
  margin-top: 1rem;
  padding: 0.875rem;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

/* ============================================================================
   MODE INDICATOR
   ============================================================================ */

.mode-indicator {
  background: rgba(255, 255, 255, 0.18);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.35);
  padding: 0.35rem 0.75rem;
  border-radius: 1rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.header-admin-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.15);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 6px;
  padding: 0.3rem 0.75rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}
.header-admin-link:hover {
  background: rgba(255, 255, 255, 0.28);
  border-color: rgba(255, 255, 255, 0.6);
  color: white;
}

/* ============================================================================
   TOAST DE NOTIFICACAO
   ============================================================================ */

.toast {
  position: absolute;
  top: 5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--sigma-primary);
  color: white;
  padding: 0.875rem 1.5rem;
  border-radius: 0.5rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  font-size: 0.875rem;
  font-weight: 500;
  z-index: 9999;
  max-width: 90%;
  animation: slideDown 0.3s ease;
}

.toast.hidden {
  display: none;
}

.toast-success {
  background: var(--sigma-success);
}

.toast-error {
  background: var(--sigma-error);
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translate(-50%, -1rem);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

/* ============================================================================
   SIDEBAR COLLAPSED
   ============================================================================ */

.sidebar-left.collapsed {
  width: 0;
  overflow: hidden;
}


/* ============================================================================
   SMART LAYERS UI - estilo TOC (Table of Contents) do ArcGIS Pro
   ============================================================================ */

.layers-container {
  display: flex;
  flex-direction: column;
  margin-top: 0.5rem;
  font-size: 0.825rem;
}

.layers-loading,
.layers-error {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.6);
  padding: 0.75rem;
  text-align: center;
}

.layers-error {
  color: var(--sigma-error);
}

.layers-refresh {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.55);
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 0.25rem;
  cursor: pointer;
  margin-left: auto;
  font-size: 1rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.layers-refresh:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--sb-green);
}

/* Marcadores PLI-Reporta — losango oficial + icone da categoria tingido pelo status */
.reporta-event-icon {
  background: transparent !important;
  border: none !important;
}

.reporta-event-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  transform: rotate(45deg);
  background: #fff;
  border: 2px solid var(--border-color, #003b5a);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.22);
  box-sizing: border-box;
}

.reporta-event-marker--legend {
  width: 16px;
  height: 16px;
  border-width: 1.5px;
  flex-shrink: 0;
}

.reporta-event-icon .reporta-event-symbol {
  width: 22px;
  height: 22px;
  filter: drop-shadow(0 0 1px rgba(255, 255, 255, 0.95));
}

.reporta-event-symbol--resolved {
  opacity: 0.72;
}

.reporta-event-marker .reporta-event-symbol {
  transform: rotate(-45deg);
  width: 14px;
  height: 14px;
}

.reporta-event-marker--legend .reporta-event-symbol {
  width: 9px;
  height: 9px;
}

.reporta-event-symbol {
  display: block;
  width: 22px;
  height: 22px;
  background-color: var(--symbol-color, #15803d);
  mask-image: var(--icon-url);
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-image: var(--icon-url);
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
}

.reporta-event-fallback {
  display: block;
  font-size: 18px;
  line-height: 1;
  text-align: center;
  text-shadow: 0 0 2px #fff;
}

.layer-swatch-reporta {
  margin-right: 0;
}

.reporta-status-legend {
  margin: 6px 8px 10px 28px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 11px;
  color: rgba(255, 255, 255, 0.72);
}

.reporta-status-legend-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
  color: rgba(255, 255, 255, 0.55);
}

.reporta-status-legend ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.reporta-status-legend li {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 2px 0;
}

.reporta-status-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--symbol-color, #15803d);
  flex-shrink: 0;
}

/* GRUPO (no TOC, e o "container" / dataset) */
.layer-group {
  margin: 0;
  padding: 0;
  --layer-indent: 2.4rem;
  --layer-tree-x: 1.4rem;
}

.layer-group + .layer-group {
  margin-top: 0.35rem;
}

.layer-group-header {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.25rem;
  cursor: pointer;
  user-select: none;
  border-radius: 0.25rem;
  transition: background 0.12s ease;
}

.layer-group-header:hover {
  background: rgba(255, 255, 255, 0.05);
}

.layer-group-toggle {
  font-size: 0.65rem;
  width: 0.9rem;
  text-align: center;
  color: rgba(255, 255, 255, 0.5);
  transition: transform 0.15s ease;
  flex-shrink: 0;
  font-family: monospace;
}

.layer-group-toggle-all {
  width: 0.95rem;
  height: 0.95rem;
  margin: 0;
  flex-shrink: 0;
  accent-color: var(--sb-green, var(--sigma-verde-forte));
  cursor: pointer;
}

.layer-group.collapsed .layer-group-toggle {
  transform: rotate(-90deg);
}

.layer-group-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--sb-text, rgba(255, 255, 255, 0.92));
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.badge-rt {
  font-size: 0.55rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: transparent;
  color: var(--sigma-verde);
  border: 1px solid var(--sigma-verde);
  padding: 0.05rem 0.35rem;
  border-radius: 0.25rem;
  font-weight: 600;
  flex-shrink: 0;
}

.layer-group-active-count {
  font-size: 0.6rem;
  background: var(--sigma-verde);
  color: var(--sigma-primary);
  padding: 0.05rem 0.35rem;
  border-radius: 0.25rem;
  font-weight: 700;
  flex-shrink: 0;
  min-width: 1.1rem;
  text-align: center;
}

.layer-group-body {
  display: flex;
  flex-direction: column;
  margin-top: 0.35rem;
  padding-left: 0.15rem;
}

.layer-group.collapsed .layer-group-body {
  display: none;
}

/* CAMADA (filho indentado, no estilo TOC) */
.layer-row {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  padding: 0.32rem 0.25rem 0.32rem var(--layer-indent, 2.4rem);
  cursor: pointer;
  border-radius: 0.25rem;
  transition: background 0.12s ease;
  position: relative;
}

.layer-row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.layer-row-line {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.layer-swatch-wrap {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.05rem;
  height: 0.85rem;
  margin-top: 0.1rem;
}

.layer-swatch-state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0.85rem;
  height: 0.85rem;
  flex-shrink: 0;
}

.layer-swatch-state svg {
  width: 0.85rem;
  height: 0.85rem;
  pointer-events: none;
}

.layer-swatch-state--error {
  color: var(--sigma-error);
}

.layer-swatch-state--warn {
  color: var(--sigma-warning);
}

.layer-progress {
  height: 1mm;
  width: 100%;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  overflow: hidden;
}

.layer-progress.hidden {
  display: none;
}

.layer-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--sigma-verde);
  border-radius: 999px;
  transition: width 0.06s linear;
}

.layer-row::before {
  content: "";
  position: absolute;
  left: var(--layer-tree-x, 1.4rem);
  top: 0;
  bottom: 50%;
  width: 1px;
  background: rgba(255, 255, 255, 0.12);
}

.layer-row::after {
  content: "";
  position: absolute;
  left: var(--layer-tree-x, 1.4rem);
  top: 50%;
  width: 0.65rem;
  height: 1px;
  background: rgba(255, 255, 255, 0.12);
}

.layer-row:last-child::before {
  bottom: 50%;
}

.layer-row:hover {
  background: rgba(255, 255, 255, 0.05);
}

.layer-row input[type="checkbox"] {
  width: 0.95rem;
  height: 0.95rem;
  accent-color: var(--sigma-verde);
  cursor: pointer;
  flex-shrink: 0;
  margin: 0;
}

.layer-swatch {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 2px;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.layer-swatch--palette {
  width: 1.05rem;
  border-color: rgba(255, 255, 255, 0.45);
}

.layer-icon {
  font-size: 0.85rem;
  flex-shrink: 0;
  display: none; /* estilo TOC: swatch ja serve de simbologia */
}

.layer-name {
  font-size: 0.78rem;
  color: var(--sb-text);
  font-weight: 500;
  flex: 1 1 0;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.layer-zoom-btn,
.layer-reload-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 1.35rem;
  height: 1.35rem;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 0.25rem;
  background: transparent;
  color: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  transition: color 0.12s ease, background 0.12s ease;
}

.layer-zoom-btn svg,
.layer-reload-btn svg {
  width: 0.85rem;
  height: 0.85rem;
  pointer-events: none;
}

.layer-zoom-btn:hover,
.layer-reload-btn:hover {
  color: var(--sb-green);
  background: rgba(255, 255, 255, 0.08);
}

.layer-zoom-btn:focus-visible,
.layer-reload-btn:focus-visible {
  outline: 1px solid var(--sigma-verde);
  outline-offset: 1px;
}

.layer-row:hover .layer-zoom-btn,
.layer-row:hover .layer-reload-btn {
  color: rgba(255, 255, 255, 0.82);
}

.layer-status {
  font-size: 0.65rem;
  color: var(--sb-text);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  flex: 0 0 auto;
  max-width: 52%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: default;
}

.layer-status-loading {
  color: var(--sb-muted);
  font-weight: 400;
}

.layer-status-ok {
  color: var(--sb-text);
  font-weight: 500;
}

.layer-status-error {
  color: var(--sigma-error);
}

.layer-status-warn {
  color: var(--sigma-warning);
}

/* Popups das camadas no mapa (Leaflet) */
.popup-layer-title {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 0.15rem;
}

.popup-layer-source {
  font-size: 0.7rem;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.5rem;
}

.popup-table {
  width: 100%;
  font-size: 0.75rem;
  border-collapse: collapse;
}

.popup-table td {
  padding: 0.2rem 0.4rem;
  border-bottom: 1px solid var(--gray-100);
}

.popup-table td:first-child {
  color: var(--gray-500);
  font-weight: 500;
}

.popup-table td:last-child {
  color: var(--gray-900);
  font-weight: 600;
  text-align: right;
}

/* Popup público PLI-Reporta (espelha mapa público oficial) */
.leaflet-popup.reporta-public-popup-wrap .leaflet-popup-content-wrapper {
  padding: 0;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.22);
}

.leaflet-popup.reporta-public-popup-wrap .leaflet-popup-content {
  margin: 0;
  width: auto !important;
  min-width: min(320px, 92vw);
  max-width: min(420px, 96vw);
  line-height: 1.35;
}

.leaflet-popup.reporta-public-popup-wrap .leaflet-popup-tip {
  display: none;
}

.reporta-public-popup-inner {
  font-family: var(--font-body, 'Inter', sans-serif);
  color: #0f172a;
}

.reporta-popup-header {
  position: relative;
  padding: 0.65rem 2.25rem 0.65rem 0.75rem;
  color: #fff;
}

.reporta-popup-header-title {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reporta-popup-header .map-popup-close {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  width: 1.5rem;
  height: 1.5rem;
  border: none;
  border-radius: 0.25rem;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.reporta-popup-header .map-popup-close:hover {
  background: rgba(255, 255, 255, 0.32);
}

.reporta-popup-body {
  padding: 0.55rem 0.65rem 0.65rem;
  background: #fff;
}

.reporta-popup-status {
  border-left: 3px solid var(--status-color, #15803d);
  border-radius: 0.35rem;
  padding: 0.45rem 0.55rem;
  margin-bottom: 0.55rem;
  font-size: 0.74rem;
}

.reporta-popup-status strong {
  display: block;
  font-size: 0.78rem;
  margin-bottom: 0.2rem;
  color: #0f172a;
}

.reporta-popup-status p {
  margin: 0;
  color: #475569;
}

.reporta-popup-section {
  margin-bottom: 0.55rem;
}

.reporta-popup-section-title {
  margin: 0 0 0.35rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
}

.reporta-popup-kv {
  margin: 0;
}

.reporta-popup-kv-row {
  display: grid;
  grid-template-columns: minmax(42%, 1fr) minmax(48%, 1.2fr);
  gap: 0.35rem 0.5rem;
  padding: 0.22rem 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.72rem;
}

.reporta-popup-kv-row:last-child {
  border-bottom: none;
}

.reporta-popup-kv-row dt {
  margin: 0;
  color: #64748b;
  font-weight: 500;
}

.reporta-popup-kv-row dd {
  margin: 0;
  color: #0f172a;
  font-weight: 600;
  text-align: right;
  word-break: break-word;
}

.reporta-popup-photo {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: 0.35rem;
  margin: 0.35rem 0 0.45rem;
}

.reporta-popup-foot {
  margin-top: 0.35rem;
  padding-top: 0.35rem;
  border-top: 1px solid #f1f5f9;
  font-size: 0.66rem;
  color: #94a3b8;
  text-align: center;
}


/* ============================================================================
   COORDENADAS - LAYOUT EM DUAS COLUNAS
   ============================================================================ */

.coord-block {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0.5rem;
  padding: 0.75rem 0.875rem 0.5rem;
  margin-bottom: 0.75rem;
}

.coord-block-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--sb-green);
  margin-bottom: 0.5rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.form-row .form-group {
  margin-bottom: 0.25rem;
}

.form-row .form-group label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--sb-text);
  font-weight: 600;
}

.form-row .form-group input {
  padding: 0.55rem 0.6rem;
  font-size: 0.8rem;
}

.coord-input {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.3px;
}

.coord-hint {
  margin-top: 0.25rem;
  font-size: 0.7rem;
}

.coord-hint code {
  background: rgba(255, 255, 255, 0.08);
  padding: 0.05rem 0.3rem;
  border-radius: 0.2rem;
  font-size: 0.7rem;
  color: var(--sb-green);
  font-weight: 600;
}

/* ============================================================================
   ROTA SMART (polilinha de desvio - aplicada automaticamente)
   ============================================================================ */

.smart-route-glow {
  filter: drop-shadow(0 0 4px rgba(62, 194, 110, 0.6));
}



/* ============================================================================
   CONTROLE DE BASEMAPS (Leaflet layers control)
   ============================================================================ */

.leaflet-control-layers {
  border: none !important;
  background: white;
  box-shadow: var(--shadow-md);
  border-radius: 0.4rem;
  font-family: var(--font-sans);
  font-size: 0.78rem;
}

.leaflet-control-layers-toggle {
  background-color: white;
  background-size: 18px 18px;
  width: 32px;
  height: 32px;
}

.leaflet-control-layers-expanded {
  padding: 0.5rem 0.65rem;
  color: var(--sigma-primary);
}

.leaflet-control-layers-expanded label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.15rem 0;
  font-weight: 500;
  cursor: pointer;
}

.leaflet-control-layers-expanded label:hover {
  color: var(--sigma-verde);
}

.leaflet-control-layers-base label input[type="radio"] {
  accent-color: var(--sigma-verde);
}

.leaflet-control-layers-separator {
  border-top: 1px solid var(--gray-200);
}


/* ============================================================================
   BOTOES DE ROTA (CONVENCIONAL + SMART)
   ============================================================================ */

.route-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-top: 1rem;
}

.auto-smart-config {
  margin-top: 0.65rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 0.45rem;
  background: rgba(255, 255, 255, 0.05);
}

.auto-smart-config label {
  display: block;
  margin-bottom: 0.35rem;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.72rem;
  font-weight: 600;
}

.auto-smart-config select {
  width: 100%;
  min-height: 1.9rem;
  padding: 0.3rem 0.45rem;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 0.35rem;
  background: #0f4c68;
  color: #fff;
  font-size: 0.73rem;
}

.auto-smart-config span {
  display: block;
  margin-top: 0.35rem;
  color: rgba(255, 255, 255, 0.66);
  font-size: 0.66rem;
  line-height: 1.35;
}

.btn-smart {
  background: linear-gradient(135deg, var(--sigma-accent) 0%, #0c4a6e 100%);
  color: white;
  box-shadow: var(--shadow-md);
  border: none;
}

.btn-smart:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  filter: brightness(1.1);
}

.btn-smart:active {
  transform: translateY(0);
}

.route-hint {
  margin-top: 0.5rem;
  font-size: 0.7rem;
  color: var(--sb-muted);
  line-height: 1.45;
}

.route-hint-conv,
.route-hint-smart {
  color: var(--sb-green);
  font-weight: 700;
}

.btn-clear-route {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.45rem;
  padding: 0.35rem 0.55rem;
  border: none;
  border-radius: 0.35rem;
  background: rgba(255, 255, 255, 0.08);
  color: var(--sb-text);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.btn-clear-route svg {
  width: 0.9rem;
  height: 0.9rem;
  flex-shrink: 0;
}

.btn-clear-route:hover {
  background: rgba(255, 255, 255, 0.14);
  color: var(--sb-green);
}

/* Legenda de camadas sobre o mapa */
.map-layer-legend {
  position: absolute;
  left: 0.75rem;
  bottom: 0.75rem;
  z-index: 450;
  max-width: min(18rem, calc(100% - 1.5rem));
  max-height: calc(100% - 1.5rem);
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0.65rem 0.75rem;
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-md);
  font-size: 0.72rem;
  color: var(--gray-700);
  pointer-events: auto;
}

.map-layer-legend.hidden {
  display: none;
}

.map-legend-header {
  position: sticky;
  top: -0.65rem;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: -0.1rem 0 0.55rem;
  padding: 0.55rem 0 0.45rem;
  border-bottom: 1px solid var(--gray-200);
  background: rgba(255, 255, 255, 0.98);
}

.map-legend-heading {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--gray-700);
}

.map-legend-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.45rem;
  height: 1.45rem;
  padding: 0;
  border: 1px solid var(--gray-300);
  border-radius: 0.35rem;
  background: #fff;
  color: var(--gray-700);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.map-legend-toggle:hover {
  border-color: var(--gray-400);
  background: var(--gray-100);
}

.map-layer-legend.is-collapsed {
  right: auto;
  left: 0.75rem;
  max-width: none;
  max-height: none;
  overflow: hidden;
  padding: 0.45rem 0.5rem;
}

.map-layer-legend.is-collapsed .map-legend-header {
  position: static;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  border-bottom: 0;
}

.map-layer-legend.is-collapsed .map-legend-content {
  display: none;
}

.map-legend-section + .map-legend-section {
  margin-top: 0.55rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--gray-200);
}

.map-legend-title {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gray-500);
  margin-bottom: 0.35rem;
}

.map-legend-subsection + .map-legend-subsection {
  margin-top: 0.4rem;
}

.map-legend-subtitle {
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: 0.25rem;
}

.map-legend-line {
  height: 3px;
  min-width: 1.1rem;
  border-radius: 1px;
}

.map-legend-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.map-legend-list li {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0.2rem 0;
  line-height: 1.3;
}

.map-legend-swatch {
  display: inline-block;
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 2px;
  flex-shrink: 0;
  background: var(--symbol-color, #64748b);
}

.map-legend-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0.85rem;
  height: 0.85rem;
  flex-shrink: 0;
}

.map-legend-icon--error {
  color: var(--sigma-error);
}

.map-legend-icon--warn {
  color: var(--sigma-warning);
}

/* ============================================================================
   BADGE DE MODO NO PAINEL DE INFO
   ============================================================================ */

.info-header {
  gap: 0.75rem;
}

.info-mode-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.25rem 0.6rem;
  border-radius: 1rem;
  white-space: nowrap;
}

.info-mode-badge.mode-convencional {
  background: rgba(255, 255, 255, 0.18);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.info-mode-badge.mode-smart {
  background: var(--sigma-verde);
  color: white;
  border: 1px solid var(--sigma-verde);
}

/* ============================================================================
   PILL DE SEVERIDADE (escala PLI: informativo|atencao|alerta|critico|bloqueado)
   ============================================================================ */

.sev-pill {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 0.75rem;
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-left: 0.4rem;
  vertical-align: middle;
}

/* ============================================================================
   RECOMENDACAO DE ROTA SMART (aparece quando rota convencional cruza adversidade)
   ============================================================================ */

.info-smart-recommendation {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border-left: 4px solid var(--sigma-warning);
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.8rem;
  color: var(--gray-800);
  line-height: 1.5;
  margin: 0.75rem 0;
}

.info-smart-recommendation.hidden {
  display: none;
}

.info-smart-recommendation strong {
  color: var(--sigma-error);
}

.btn-recommend {
  display: block;
  width: 100%;
  margin-top: 0.6rem;
  padding: 0.5rem 0.75rem;
  background: var(--sigma-verde);
  color: white;
  border: none;
  border-radius: 0.375rem;
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
  transition: filter 0.15s ease;
}

.btn-recommend:hover {
  filter: brightness(1.1);
}

/* Detalhamento por camada (lista no painel) */
#risk-zones-list li {
  padding: 0.5rem 0;
}

#risk-zones-list li.muted {
  color: var(--gray-500);
  font-style: italic;
}

#risk-zones-list small {
  color: var(--gray-500);
  font-size: 0.7rem;
}


/* ============================================================================
   EXPORT MENU (JSON / Shapefile)
   ============================================================================ */

.export-wrapper {
  position: relative;
  margin-top: 0.5rem;
}

.export-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.export-caret {
  font-size: 0.7rem;
  margin-left: 0.4rem;
  opacity: 0.7;
}

.export-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: white;
  border-radius: 0.5rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  z-index: 500;
  overflow: hidden;
}

.export-menu.hidden {
  display: none;
}

.export-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  padding: 0.6rem 0.8rem;
  background: white;
  border: none;
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer;
  width: 100%;
  text-align: left;
  font-family: var(--font-sans);
  transition: background 0.15s ease;
}

.export-item:last-child {
  border-bottom: none;
}

.export-item:hover {
  background: var(--gray-50);
}

.export-item strong {
  color: var(--sigma-primary);
  font-size: 0.85rem;
  font-weight: 600;
}

.export-item small {
  color: var(--gray-600);
  font-size: 0.7rem;
  font-weight: 400;
}

/* --- Câmeras DER-SP --- */
.layer-swatch-der-camera,
.route-camera-link-icon,
.der-camera-marker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.layer-swatch-der-camera svg,
.route-camera-link-icon svg,
.der-camera-marker svg {
  width: 18px;
  height: 18px;
}

.der-camera-icon {
  background: transparent;
  border: none;
}

.der-camera-marker {
  width: 30px;
  height: 30px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25));
}

.der-camera-marker--maint {
  opacity: 0.55;
}

.der-camera-popup-wrap .leaflet-popup-content {
  margin: 0;
  width: 320px !important;
}

.der-camera-popup {
  font-size: 0.82rem;
  color: var(--gray-800, #1e293b);
}

.der-camera-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.65rem;
  background: #111827;
  color: #fff;
}

.der-camera-popup-header strong {
  font-size: 0.78rem;
  line-height: 1.3;
}

.der-camera-popup-body {
  padding: 0.65rem;
}

.der-camera-video-wrap {
  position: relative;
  background: #000;
  border-radius: 6px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  margin-bottom: 0.55rem;
}

.der-camera-video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.der-camera-video-wrap--ready .der-camera-loader {
  display: none;
}

.der-camera-video-wrap--ready .der-camera-video {
  opacity: 1;
}

.der-camera-loader {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 0.75rem;
  z-index: 2;
  padding: 0.5rem;
  text-align: center;
}

.der-camera-retry-btn {
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.der-camera-retry-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}

.der-camera-live {
  position: absolute;
  left: 8px;
  bottom: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(220, 38, 38, 0.75);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  z-index: 3;
  text-transform: uppercase;
}

.der-camera-live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
  animation: der-camera-blink 1.4s infinite;
}

@keyframes der-camera-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.der-camera-error {
  background: #1a1a1a;
  color: #d1ecf1;
  border-radius: 6px;
  padding: 1rem 0.75rem;
  text-align: center;
  margin-bottom: 0.55rem;
  font-size: 0.78rem;
}

.der-camera-meta {
  display: grid;
  gap: 0.35rem;
  font-size: 0.74rem;
}

.der-camera-meta div {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
}

.der-camera-meta span {
  color: var(--gray-500, #64748b);
}

.route-cameras-section {
  margin-bottom: 0.25rem;
}

.route-cameras-hint {
  margin: 0 0 0.5rem;
  font-size: 0.74rem;
  color: var(--gray-500, #64748b);
}

.route-cameras-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.route-camera-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--gray-200, #e2e8f0);
  border-radius: 999px;
  background: var(--gray-50, #f8fafc);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.72rem;
  color: var(--gray-800, #1e293b);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.route-camera-link:hover {
  background: #fff;
  border-color: #111827;
}

.route-camera-link-label {
  font-weight: 600;
  max-width: 160px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================================================
   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-container {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 0.45rem;
  row-gap: 0.1rem;
  align-items: center;
  align-content: center;
  justify-content: start;
  text-align: left;
  font-size: 1.65rem;
}
.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:last-child { 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-container { column-gap: 0.35rem; }
.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; }
