/* =====================================================================
   DESIGN SYSTEM OFICIAL — SESC MESA BRASIL PARANÁ
   Painel de Inteligência Operacional, Impacto Socioambiental & ESG
   ===================================================================== */


:root {
  /* Cores Institucionais Oficiais Sesc Paraná & Sesc Mesa Brasil */
  --primary-sesc: #004C99;          /* Azul Institucional Oficial Sesc (Pantone 288 C) */
  --primary-sesc-hover: #003B77;    /* Azul Sesc Hover */
  --primary-sesc-dark: #002D62;     /* Azul Marinho Nobre Sesc (Pantone 534 C) */
  --primary-sesc-deep: #001A3A;     /* Azul Marinho Profundo Sidebar */
  --accent-sesc-yellow: #F6BE00;    /* Amarelo Institucional Sesc (Pantone 7408 C) */
  --accent-sesc-yellow-hover: #DDA800;
  --accent-sesc-sky: #009AE6;       /* Azul Céu de Apoio Sesc (Pantone 2925 C) */
  --accent-sesc-sky-bg: #E6F3FB;    /* Fundo Azul Suave */

  /* Mapeamento Semântico Sesc */
  --primary-deep: #001A3A;          /* Sidebar Escura Oficial Sesc */
  --primary-deep-surface: #002D62;  /* Azul Marinho Cartões */
  --primary-dark: #002D62;          /* Azul Escuro */
  --primary-emerald: #004C99;       /* Ação Primária Oficial Azul Sesc */
  --primary-emerald-hover: #003B77; /* Hover Primário */
  --primary-light: #009AE6;         /* Realce Azul Céu */
  --primary-mint: #E6F0FA;          /* Azul Suave Badges */
  --primary-mint-border: #BAdaf5;   /* Borda Azul Suave */

  /* Cores de Apoio dos Indicadores e ESG */
  --accent-esg-green: #10B981;      /* Verde Hortifrúti & ESG */
  --accent-esg-green-bg: #E8F5EE;
  --accent-orange: #EA580C;         /* Laranja Nutrição / Refeições */
  --accent-orange-bg: #FFF7ED;     /* Fundo Laranja Suave */
  --accent-orange-border: #FFEDD5;
  --accent-blue: #004C99;          /* Azul Econômico Oficial Sesc */
  --accent-blue-bg: #E6F0FA;       /* Fundo Azul Suave */
  --accent-blue-border: #BAdaf5;
  --accent-gold: #F6BE00;          /* Dourado Selo Ouro Sesc */
  --accent-silver: #747678;        /* Prateado Cool Gray 9 C */
  --accent-green-alt: #10B981;     /* Verde Preservação */
  --accent-green-bg: #F0FDF4;

  /* Superfícies & Layout (Tema Claro) */
  --bg-app: #F4F6F9;               /* Cinza Neutro Corporativo Sesc */
  --bg-surface: #FFFFFF;           /* Branco Cartões */
  --bg-surface-alt: #F8FAFC;       /* Fundo Secundário */
  --border-color: #E2E8F0;         /* Linhas e Divisores */
  --border-light: #EDF2F7;
  --border-subtle: #F1F5F9;

  /* Tipografia */
  --text-primary: #0F172A;         /* Preto Ardósia / Títulos */
  --text-secondary: #334155;       /* Texto Médio */
  --text-muted: #64748B;           /* Legendas / Subtextos */
  --text-dim: #94A3B8;             /* Desabilitados */
  --text-on-dark: #FFFFFF;

  /* Sombras & Efeitos */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --transition-fast: 0.15s ease;
  --transition-smooth: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Modo Escuro Sesc */
[data-theme="dark"] {
  --primary-sesc: #009AE6;
  --primary-sesc-hover: #38BDF8;
  --primary-sesc-dark: #001A3A;
  --primary-sesc-deep: #060F1E;
  --primary-deep: #060F1E;
  --primary-deep-surface: #0A192F;
  --primary-dark: #0A192F;
  --primary-emerald: #009AE6;
  --primary-emerald-hover: #38BDF8;
  --primary-light: #38BDF8;
  --primary-mint: #0C2340;
  --primary-mint-border: #1E3A5F;

  --bg-app: #060F1E;
  --bg-surface: #0A192F;
  --bg-surface-alt: #0D223F;
  --border-color: #173256;
  --border-light: #1E3A5F;
  --border-subtle: #132742;
  --text-primary: #F8FAFC;
  --text-secondary: #E2E8F0;
  --text-muted: #94A3B8;
  --text-dim: #64748B;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11", "tnum";
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, .font-heading {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  letter-spacing: -0.025em;
}

/* Container da Aplicação */
.app-container {
  display: flex;
  width: 100vw;
  min-height: 100vh;
}

/* =====================================================================
   SIDEBAR CORPORATIVA (Azul Sesc Institucional & Azul Marinho)
   ===================================================================== */
.sidebar {
  width: 250px;
  background-color: var(--primary-sesc-deep);
  color: #FFFFFF;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: relative;
  z-index: 50;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.22);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  background-image: linear-gradient(180deg, #001A3A 0%, #002D62 60%, #001530 100%);
}

.sidebar-header {
  padding: 20px 16px 16px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-logo-card {
  width: 100%;
  background: #FFFFFF;
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.15);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.brand-logo-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.brand-logo-img {
  width: 100%;
  height: auto;
  max-height: 48px;
  object-fit: contain;
  display: block;
}

.brand-leaf-icon {
  width: 38px;
  height: 38px;
  background: var(--primary-sesc);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  font-size: 20px;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}

.brand-text h1 {
  font-size: 19px;
  font-weight: 800;
  color: #FFFFFF;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.brand-text p {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--accent-sesc-yellow);
  text-transform: uppercase;
  margin-top: 2px;
}

.sidebar-nav {
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: rgba(255, 255, 255, 0.78);
  background: transparent;
  border: none;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color var(--transition-fast), color var(--transition-fast);
  text-align: left;
  width: 100%;
}

.nav-item i {
  font-size: 17px;
  color: rgba(255, 255, 255, 0.65);
  transition: color var(--transition-fast);
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #FFFFFF;
}

.nav-item:hover i {
  color: var(--accent-sesc-yellow);
}

.nav-item.active {
  background: var(--primary-sesc);
  color: #FFFFFF;
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(0, 76, 153, 0.45);
  border-left: 3px solid var(--accent-sesc-yellow);
}

.nav-item.active i {
  color: var(--accent-sesc-yellow);
}

.sidebar-footer {
  padding: 20px;
  background: rgba(0, 0, 0, 0.25);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sesc-brand-seal {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sesc-logo-badge {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  font-size: 20px;
  color: #FFFFFF;
  letter-spacing: -0.04em;
  font-style: italic;
  display: flex;
  flex-direction: column;
}

.sesc-logo-badge span {
  font-size: 7.5px;
  letter-spacing: 0.1em;
  color: var(--accent-sesc-yellow);
  font-style: normal;
  text-transform: uppercase;
}

.sesc-tagline {
  font-size: 10px;
  line-height: 1.3;
  color: rgba(255, 255, 255, 0.6);
  border-left: 1px solid rgba(255, 255, 255, 0.2);
  padding-left: 10px;
}

/* =====================================================================
   MAIN WRAPPER & TOPBAR
   ===================================================================== */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
}

.topbar {
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 16px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 40;
}

.topbar-titles h2 {
  font-size: 21px;
  color: var(--text-primary);
  font-weight: 800;
  letter-spacing: -0.03em;
}

.topbar-titles p {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.firebase-status-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-color);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.firebase-status-pill .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10B981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
}

.firebase-status-pill .status-dot.error {
  background: #EF4444;
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.6);
}

.firebase-status-pill .latency-label {
  font-size: 10.5px;
  color: var(--primary-emerald);
  background: var(--primary-mint);
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 700;
}

.top-select-btn {
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: border-color var(--transition-fast), background-color var(--transition-fast), color var(--transition-fast);
}

.top-select-btn:hover {
  border-color: var(--primary-emerald);
}

.theme-toggle-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: var(--bg-surface-alt);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 15px;
  transition: background-color var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

.theme-toggle-btn:hover {
  background: var(--border-light);
  color: var(--text-primary);
}

.admin-profile-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 4px 4px;
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-color);
  border-radius: 30px;
}

.admin-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #3B82F6;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
}

.admin-info {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  text-align: left;
}

.admin-info .name {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.05em;
}

.admin-info .role {
  font-size: 10px;
  color: var(--text-muted);
}

.btn-export-green {
  background: var(--primary-emerald);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-size: 12.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: background-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
  box-shadow: 0 2px 6px rgba(0, 76, 153, 0.25);
}

.btn-export-green:hover {
  background: var(--primary-emerald-hover);
  box-shadow: 0 4px 10px rgba(0, 76, 153, 0.35);
}

/* =====================================================================
   BARRA DE FILTROS DINÂMICOS
   ===================================================================== */
.dashboard-body {
  padding: 24px 28px 40px 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.filter-strip-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.filter-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
}

.filter-title i {
  color: var(--primary-emerald);
  font-size: 16px;
}

.btn-reset-clean {
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.btn-reset-clean:hover {
  background: var(--bg-surface-alt);
  border-color: var(--primary-emerald);
  color: var(--primary-emerald);
}

.filter-controls-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter-field label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
}

.filter-field select {
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color var(--transition-fast);
}

.filter-field select:focus-visible {
  outline: 2px solid var(--primary-emerald);
  outline-offset: 2px;
  border-color: var(--primary-emerald);
}

/* =====================================================================
   GRADE DE 5 CARDS DE KPI (TOP ROW)
   ===================================================================== */
.kpi-row-5 {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
}

.kpi-card-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px 16px;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 140px;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.kpi-card-box:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.kpi-top-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.kpi-icon-pill {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.kpi-icon-pill.green { background: var(--accent-sesc-sky-bg); color: var(--primary-sesc); }
.kpi-icon-pill.orange { background: #FEF3C7; color: #D97706; }
.kpi-icon-pill.emerald { background: var(--primary-mint); color: var(--primary-sesc); }
.kpi-icon-pill.forest { background: var(--accent-sesc-sky-bg); color: var(--primary-sesc-dark); }
.kpi-icon-pill.blue { background: #DBEAFE; color: #004C99; }

.kpi-label-text {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.kpi-main-number {
  font-size: 21px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  margin-bottom: 6px;
}

.kpi-growth-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 4px;
}

.growth-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 700;
}

.growth-badge.positive {
  background: var(--accent-sesc-sky-bg);
  color: var(--primary-sesc);
}

.growth-sub {
  color: var(--text-muted);
  font-weight: 500;
}

.kpi-footnote-text {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Micro-Gráfico Sparkbars */
.kpi-sparkbars {
  position: absolute;
  right: 14px;
  bottom: 16px;
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 36px;
}

.kpi-sparkbars .bar {
  width: 4px;
  border-radius: 2px;
  opacity: 0.85;
}

.kpi-sparkbars.green .bar { background: var(--primary-sesc); }
.kpi-sparkbars.orange .bar { background: #EA580C; }
.kpi-sparkbars.emerald .bar { background: #059669; }
.kpi-sparkbars.forest .bar { background: #15803D; }
.kpi-sparkbars.blue .bar { background: #2563EB; }

/* =====================================================================
   PAINEL CENTRAL: MAPA DO PARANÁ, PERFIL & HERO INSTITUCIONAL
   ===================================================================== */
.middle-grid-3 {
  display: grid;
  grid-template-columns: 2.1fr 1.6fr 1.3fr;
  gap: 18px;
}

.content-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
}

.panel-title-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.panel-title-bar h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.panel-title-bar p {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Mapa do Paraná + Top 10 Lista */
.map-and-rank-layout {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 16px;
  flex: 1;
  align-items: center;
}

.map-container-box {
  position: relative;
  background: var(--bg-surface-alt);
  border-radius: var(--radius-sm);
  padding: 10px;
  border: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.map-zoom-controls {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 10;
}

.btn-zoom {
  width: 24px;
  height: 24px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
}

.btn-zoom:hover {
  background: var(--border-light);
}

.parana-svg-map {
  width: 100%;
  height: 180px;
}

.map-legend-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 8px;
}

.legend-gradient {
  height: 6px;
  flex: 1;
  margin: 0 8px;
  border-radius: 3px;
  background: linear-gradient(90deg, #BAdaf5 0%, #009AE6 35%, #004C99 70%, #002D62 100%);
}

.rank-top10-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rank-item-row {
  display: grid;
  grid-template-columns: 16px 75px 1fr 65px;
  align-items: center;
  gap: 6px;
  font-size: 11px;
}

.rank-item-row .pos {
  font-weight: 700;
  color: var(--text-muted);
}

.rank-item-row .city-name {
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rank-bar-bg {
  height: 5px;
  background: var(--border-light);
  border-radius: 3px;
  overflow: hidden;
}

.rank-bar-fill {
  height: 100%;
  background: var(--primary-emerald);
  border-radius: 3px;
}

.rank-item-row .val {
  font-weight: 700;
  color: var(--text-primary);
  text-align: right;
  font-feature-settings: "tnum";
}

/* Gráfico de Rosca (Destinação por Perfil) */
.donut-chart-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  position: relative;
}

.donut-inner-canvas {
  position: relative;
  width: 170px;
  height: 170px;
  margin: 0 auto;
}

.donut-center-legend {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}

.donut-center-legend .kg {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-primary);
}

.donut-center-legend .sub {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.donut-legend-breakdown {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}

.legend-item-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
}

.legend-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.legend-dot.prep { background: #004C99; }
.legend-dot.med-prep { background: #009AE6; }
.legend-dot.med { background: #F6BE00; }

.legend-percent {
  font-weight: 700;
  color: var(--text-primary);
}

.panel-alert-quote {
  background: var(--accent-sesc-sky-bg);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--primary-sesc-dark);
  margin-top: 14px;
}

.panel-alert-quote i {
  font-size: 15px;
  color: var(--primary-sesc);
  flex-shrink: 0;
}

/* Hero Banner Institucional de Floresta */
.hero-impact-card {
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px 20px;
  background-image: url('../assets/img/forest_banner.jpg');
  background-size: cover;
  background-position: center;
  box-shadow: var(--shadow-md);
  color: #FFFFFF;
}

.hero-impact-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 45, 98, 0.85) 0%, rgba(0, 26, 58, 0.95) 100%);
  backdrop-filter: blur(2px);
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  height: 100%;
  justify-content: space-between;
}

.hero-top-seal {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hero-seal-badge {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #FFFFFF;
}

.hero-top-seal h4 {
  font-size: 17px;
  font-weight: 800;
  line-height: 1.25;
  color: #FFFFFF;
}

.hero-stats-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 24px;
}

.hero-stat-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  backdrop-filter: blur(6px);
}

.hero-stat-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #FFFFFF;
  flex-shrink: 0;
}

.hero-stat-text {
  display: flex;
  flex-direction: column;
}

.hero-stat-text .bold {
  font-size: 13.5px;
  font-weight: 700;
  color: #FFFFFF;
}

.hero-stat-text .desc {
  font-size: 10.5px;
  color: rgba(255, 255, 255, 0.8);
}

/* =====================================================================
   SÉRIE HISTÓRICA MENSAL (BOTTOM PANEL)
   ===================================================================== */
.bottom-history-panel {
  display: grid;
  grid-template-columns: 3.5fr 1fr;
  gap: 20px;
}

.chart-history-box {
  height: 180px;
  width: 100%;
}

.evolution-card-side {
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.evolution-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
}

.evolution-stat-block {
  margin: 16px 0;
}

.evolution-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

.evolution-val-huge {
  font-size: 28px;
  font-weight: 800;
  color: var(--primary-sesc);
  margin-top: 4px;
}

.evolution-sub {
  font-size: 11px;
  color: var(--text-dim);
}

/* =====================================================================
   MODAL DE METODOLOGIA CIENTÍFICA & FONTES AUDITÁVEIS
   ===================================================================== */
.methodology-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.methodology-modal-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-color);
}

.methodology-modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.methodology-modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.audit-table-custom {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.audit-table-custom th {
  background: var(--bg-surface-alt);
  padding: 10px 14px;
  text-align: left;
  font-weight: 700;
  color: var(--text-primary);
  border-bottom: 2px solid var(--border-color);
}

.audit-table-custom td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
}

/* =====================================================================
   TABELAS DE DADOS (DOADORES & ENTIDADES)
   ===================================================================== */
.table-responsive {
  overflow-x: auto;
  width: 100%;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  background: var(--bg-surface-alt);
  padding: 12px 16px;
  text-align: left;
  font-weight: 700;
  color: var(--text-primary);
  border-bottom: 2px solid var(--border-color);
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
}

.data-table tr:hover td {
  background: var(--bg-surface-alt);
}

.badge-ouro {
  background: #FEF3C7;
  color: #B45309;
  border: 1px solid #FDE68A;
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 11px;
}

.badge-prata {
  background: #F1F5F9;
  color: #475569;
  border: 1px solid #E2E8F0;
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 11px;
}

.badge-dev {
  background: #F8FAFC;
  color: #94A3B8;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
}

/* Responsividade Básica */
@media (max-width: 1200px) {
  .middle-grid-3 {
    grid-template-columns: 1fr;
  }
  .kpi-row-5 {
    grid-template-columns: repeat(3, 1fr);
  }
  .filter-controls-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
  }
  .kpi-row-5 {
    grid-template-columns: 1fr;
  }
  .filter-controls-row {
    grid-template-columns: 1fr;
  }
  .bottom-history-panel {
    grid-template-columns: 1fr;
  }
}

/* Customizações do Mapa Leaflet do Paraná */
#paranaLeafletMap {
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  outline: none;
}

.parana-map-tooltip {
  background: var(--bg-surface) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius-sm) !important;
  box-shadow: var(--shadow-md) !important;
  padding: 6px 10px !important;
}

.leaflet-container {
  font-family: inherit !important;
}

.leaflet-control-zoom {
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius-sm) !important;
  box-shadow: var(--shadow-sm) !important;
  overflow: hidden;
}

.leaflet-control-zoom a {
  background: var(--bg-surface) !important;
  color: var(--text-primary) !important;
  border-bottom: 1px solid var(--border-light) !important;
}

/* =====================================================================
   FAIXA DE ALINHAMENTO AOS ODS DA ONU & PEGADA HÍDRICA
   ===================================================================== */
.ods-impact-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-xs);
  flex-wrap: wrap;
}

.ods-badges-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ods-badge-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 700;
  color: #FFFFFF;
  text-decoration: none;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  transition: transform var(--transition-fast);
}

.ods-badge-item:hover {
  transform: translateY(-1px);
}

.ods-badge-item.ods-2 {
  background: linear-gradient(135deg, #DDA63A 0%, #B8860B 100%);
}

.ods-badge-item.ods-12 {
  background: linear-gradient(135deg, #CF8D2A 0%, #A06810 100%);
}

.ods-badge-item.ods-13 {
  background: linear-gradient(135deg, #48773E 0%, #2E5325 100%);
}

.water-footprint-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #E0F2FE;
  border: 1px solid #BAE6FD;
  padding: 6px 14px;
  border-radius: 6px;
  color: #0369A1;
}

.water-footprint-pill i {
  font-size: 18px;
  color: #0284C7;
}

.water-footprint-text {
  display: flex;
  flex-direction: column;
}

.water-footprint-text strong {
  font-size: 12px;
  font-weight: 800;
  color: #0C4A6E;
}

.water-footprint-text span {
  font-size: 10.5px;
  color: #0284C7;
}

/* =====================================================================
   CERTIFICADO ESG DO DOADOR TIMBRADO (MODAL & PDF) — A4 PAISAGEM OFICIAL
   ===================================================================== */
.cert-modal-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  max-width: 1120px;
  width: 96vw;
  max-height: 94vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-color);
}

.cert-print-sheet.cert-print-landscape {
  width: 1024px;
  min-width: 1024px;
  height: 724px;
  min-height: 724px;
  box-sizing: border-box;
  background-color: #FFFFFF;
  background-image: url('../assets/img/cert_bg_frame.png');
  background-size: 100% 100%;
  background-repeat: no-repeat;
  background-position: center;
  position: relative;
  padding: 24px 44px 18px 44px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  border-radius: 4px;
  color: #0F172A;
  font-family: 'Inter', sans-serif;
  margin: 0 auto;
}

.cert-top-header {
  text-align: center;
}

.cert-header-logos-container {
  display: flex;
  justify-content: center;
  margin-bottom: 4px;
}

.cert-header-logos-img {
  height: 58px;
  width: auto;
  object-fit: contain;
}

.cert-institution-title {
  font-size: 17px;
  font-weight: 900;
  color: #002D62;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-top: 2px;
  line-height: 1.2;
}

.cert-sub-institution {
  font-size: 10.5px;
  font-weight: 700;
  color: #B68625;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  margin-top: 1px;
}

.cert-law-reference {
  font-size: 9px;
  font-weight: 700;
  color: #004C99;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  margin-top: 3px;
}

.cert-title-block {
  text-align: center;
  margin-top: 2px;
}

.cert-title {
  font-size: 24px;
  font-weight: 900;
  color: #002D62;
  letter-spacing: -0.01em;
  margin: 8px 0 3px 0;
  line-height: 1.15;
  text-transform: uppercase;
}

.cert-proclamation {
  font-size: 11px;
  color: #475569;
  max-width: 760px;
  margin: 0 auto;
  line-height: 1.35;
}

.cert-donor-wrapper {
  display: flex;
  justify-content: center;
  margin-top: 6px;
}

.cert-donor-box {
  background: #E6F0FA;
  border-radius: 8px;
  padding: 5px 36px;
  font-size: 22px;
  font-weight: 900;
  color: #002D62;
  display: inline-block;
  letter-spacing: -0.01em;
}

.cert-selo-wrapper {
  display: flex;
  justify-content: center;
  margin-top: 4px;
}

.cert-badge-selo-ouro {
  background: linear-gradient(135deg, #F3C966 0%, #E5A823 100%);
  color: #4A3300;
  font-size: 11px;
  font-weight: 800;
  border-radius: 999px;
  padding: 3px 18px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 1px 4px rgba(229, 168, 35, 0.25);
  display: inline-block;
}

.cert-badge-selo-prata {
  background: linear-gradient(135deg, #E2E8F0 0%, #94A3B8 100%);
  color: #1E293B;
  font-size: 11px;
  font-weight: 800;
  border-radius: 999px;
  padding: 3px 18px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 1px 4px rgba(100, 116, 139, 0.2);
  display: inline-block;
}

.cert-badge-selo-bronze {
  background: linear-gradient(135deg, #FDE68A 0%, #D97706 100%);
  color: #78350F;
  font-size: 11px;
  font-weight: 800;
  border-radius: 999px;
  padding: 3px 18px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 1px 4px rgba(217, 119, 6, 0.2);
  display: inline-block;
}

.cert-metrics-row-6 {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin: 8px auto 6px auto;
  max-width: 930px;
  width: 100%;
  box-sizing: border-box;
}

.cert-metric-card-lnd {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 8px 4px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

.cert-metric-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #E6F0FA;
  color: #004C99;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  margin-bottom: 5px;
}

.cert-icon-co2 {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cert-icon-co2 span {
  position: absolute;
  font-size: 7.5px;
  font-weight: 900;
  margin-top: 1px;
  color: #004C99;
}

.cert-metric-card-lnd .val {
  font-size: 14px;
  font-weight: 800;
  color: #0F172A;
  white-space: nowrap;
  line-height: 1.15;
}

.cert-metric-card-lnd .lbl {
  font-size: 7.5px;
  font-weight: 700;
  color: #64748B;
  text-transform: uppercase;
  margin-top: 3px;
  line-height: 1.15;
}

.cert-legal-box {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 6px;
  padding: 6px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 3px auto 0 auto;
  max-width: 930px;
  width: 100%;
  box-sizing: border-box;
}

.cert-legal-icon {
  font-size: 22px;
  color: #004C99;
  display: flex;
  align-items: center;
  padding-right: 12px;
  border-right: 1px solid #CBD5E1;
}

.cert-legal-text {
  font-size: 8.5px;
  line-height: 1.35;
  color: #334155;
  text-align: left;
}

.cert-signatures-row {
  display: flex;
  justify-content: space-around;
  margin: 12px auto 0 auto;
  padding-top: 0;
  max-width: 820px;
  width: 100%;
}

.cert-sig-block {
  text-align: center;
  width: 260px;
}

.cert-sig-line {
  width: 220px;
  border-top: 1.5px solid #1E293B;
  margin: 0 auto 4px auto;
}

.cert-sig-title {
  font-size: 10.5px;
  font-weight: 800;
  color: #0F172A;
}

.cert-sig-sub {
  font-size: 8.5px;
  color: #475569;
  font-weight: 500;
}

.cert-footer-audit {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 8px;
  color: #64748B;
  margin: 8px auto 0 auto;
  padding-top: 5px;
  border-top: 1px solid #E2E8F0;
  max-width: 820px;
  width: 100%;
}

.cert-footer-divider {
  color: #CBD5E1;
  font-weight: 300;
}

@media print {
  body * {
    visibility: hidden;
  }
  
  /* Impressão do Certificado ESG Oficial (A4 Paisagem) */
  #certModal, #certModal * {
    visibility: visible;
  }
  #certModal {
    position: absolute;
    left: 0;
    top: 0;
    width: 297mm;
    height: 210mm;
    background: transparent;
    padding: 0;
    margin: 0;
  }
  .cert-modal-card {
    border: none !important;
    box-shadow: none !important;
    width: 297mm !important;
    height: 210mm !important;
    max-width: 297mm !important;
    max-height: 210mm !important;
    margin: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
  }
  .methodology-modal-header,
  .cert-action-bar,
  #btnCloseCertModal {
    display: none !important;
  }
  .cert-body-wrapper {
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
    background: transparent !important;
  }
  .cert-print-sheet {
    width: 297mm !important;
    height: 210mm !important;
    min-width: 297mm !important;
    min-height: 210mm !important;
    margin: 0 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    page-break-after: avoid;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* Impressão da Ficha Sanitária do Lote (A4 Retrato) */
  #sanitaryBatchModal, #sanitaryBatchModal * {
    visibility: visible;
  }
  #sanitaryBatchModal {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    background: #FFFFFF !important;
    padding: 0;
    margin: 0;
  }
  #sanitaryBatchModal .methodology-modal-header,
  #sanitaryBatchModal #btnPrintSanitaryDoc,
  #sanitaryBatchModal #btnCloseSanitaryModal {
    display: none !important;
  }
  .sanitary-modal-card {
    border: none !important;
    box-shadow: none !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 20px !important;
    background: #FFFFFF !important;
  }

  /* Impressão da Guia de Despacho Preventivo - ODP (A4 Retrato) */
  #dispatchGuideModal, #dispatchGuideModal * {
    visibility: visible;
  }
  #dispatchGuideModal {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    background: #FFFFFF !important;
    padding: 0;
    margin: 0;
  }
  #dispatchGuideModal .methodology-modal-header,
  #dispatchGuideModal #btnPrintDispatchGuide,
  #dispatchGuideModal #btnCloseDispatchGuide,
  #dispatchGuideModal #btnGoToFefoAi {
    display: none !important;
  }
  .dispatch-guide-card {
    border: none !important;
    box-shadow: none !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 20px !important;
    background: #FFFFFF !important;
  }
}

/* Estilos de Gerenciamento da Base de Dados & Exclusão de Lotes */
.btn-danger-outline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: #DC2626;
  border: 1px solid #FCA5A5;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-danger-outline:hover {
  background: #FEE2E2;
  border-color: #EF4444;
  color: #B91C1C;
}

.btn-action-delete-batch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #FEE2E2;
  color: #991B1B;
  border: 1px solid #FECACA;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.btn-action-delete-batch:hover {
  background: #EF4444;
  color: #FFFFFF;
  border-color: #DC2626;
}

/* =====================================================================
   MÉTRICAS TERRITORIAIS & FILTROS DA REDE SOCIOASSISTENCIAL
   ===================================================================== */
.territory-metrics-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.territory-metric-card {
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.territory-metric-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--accent-sesc-sky-bg);
  color: var(--primary-sesc);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.territory-metric-info .val {
  font-size: 19px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}

.territory-metric-info .lbl {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  margin-top: 2px;
}

.territory-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.search-box-input {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  flex: 1;
  max-width: 380px;
}

.search-box-input input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 13px;
  color: var(--text-primary);
  width: 100%;
}

/* =====================================================================
   IMPACTO SOCIAL & RETORNO SOBRE O INVESTIMENTO (SROI)
   ===================================================================== */
.sroi-hero-banner {
  background: linear-gradient(135deg, #002D62 0%, #004C99 50%, #001A3A 100%);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  box-shadow: var(--shadow-md);
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.sroi-hero-banner::after {
  content: "";
  position: absolute;
  right: -50px;
  bottom: -50px;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(246, 190, 0, 0.25) 0%, transparent 70%);
  pointer-events: none;
}

.sroi-multiplier-box {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.sroi-huge-number {
  font-size: 48px;
  font-weight: 900;
  color: var(--accent-sesc-yellow);
  letter-spacing: -0.03em;
  line-height: 1;
}

.sroi-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.sroi-stat-pill {
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 12px 18px;
  text-align: center;
}

.sroi-stat-pill .p-val {
  font-size: 22px;
  font-weight: 800;
  color: #FFFFFF;
}

.sroi-stat-pill .p-lbl {
  font-size: 11px;
  color: #D1FAE5;
  text-transform: uppercase;
  margin-top: 4px;
}

@media (max-width: 900px) {
  .territory-metrics-row {
    grid-template-columns: repeat(2, 1fr);
  }
  .sroi-grid-2 {
    grid-template-columns: 1fr;
  }
  .sroi-hero-banner {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* =====================================================================
   UTILITÁRIOS DE ACESSIBILIDADE WCAG 2.1 AA
   ===================================================================== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.dropzone-accessible {
  transition: border-color 0.2s ease, background-color 0.2s ease, outline 0.2s ease;
}

.dropzone-accessible:focus-visible {
  outline: 3px solid var(--primary-emerald) !important;
  outline-offset: 4px;
}

.search-box-input input:focus-visible {
  outline: 2px solid var(--primary-emerald);
  outline-offset: 1px;
  border-color: var(--primary-emerald);
}

/* ==========================================================================
   MÓDULO DE AUTENTICAÇÃO INSTITUCIONAL & SEGREGAÇÃO OPERACIONAL (RBAC)
   ========================================================================== */

.sidebar-section-divider {
  display: flex;
  align-items: center;
  margin: 18px 12px 8px 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-section-divider span {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.45);
  text-transform: uppercase;
}

.restricted-nav-item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-lock-badge {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.4);
  margin-left: auto;
  transition: color 0.18s ease;
}

.nav-item:hover .nav-lock-badge {
  color: #F59E0B;
}

.user-access-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-auth-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid rgba(5, 150, 105, 0.4);
  background: rgba(5, 150, 105, 0.08);
  color: var(--primary-emerald);
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.btn-auth-action:hover {
  background: var(--primary-emerald);
  color: #FFFFFF;
  border-color: var(--primary-emerald);
}

.btn-auth-action:focus-visible {
  outline: 2px solid var(--primary-emerald);
  outline-offset: 2px;
}

.btn-auth-action.btn-logout-state {
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.08);
  color: #DC2626;
}

.btn-auth-action.btn-logout-state:hover {
  background: #DC2626;
  color: #FFFFFF;
  border-color: #DC2626;
}

.login-modal-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  max-width: 560px;
  width: 92vw;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  border: 1px solid var(--border-color);
  animation: modalScaleIn 0.22s ease-out;
}

.quick-profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.quick-profile-btn {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s ease, background-color 0.18s ease, transform 0.18s ease;
}

.quick-profile-btn:hover {
  border-color: var(--primary-emerald);
  background: rgba(5, 150, 105, 0.06);
  transform: translateY(-1px);
}

.quick-profile-btn:focus-visible {
  outline: 2px solid var(--primary-emerald);
  outline-offset: 1px;
}

.quick-profile-btn .qp-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(5, 150, 105, 0.12);
  color: var(--primary-emerald);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

.quick-profile-btn .qp-info {
  display: flex;
  flex-direction: column;
}

.quick-profile-btn .qp-info strong {
  font-size: 12px;
  color: var(--text-primary);
  font-weight: 700;
}

.quick-profile-btn .qp-info span {
  font-size: 10.5px;
  color: var(--text-muted);
  line-height: 1.3;
  margin-top: 2px;
}

.login-input {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 13px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.login-input:focus {
  outline: none;
  border-color: var(--primary-emerald);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
}

.jurisdiction-indicator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  background: var(--accent-sesc-sky-bg);
  color: var(--primary-sesc-dark);
  border: 1px solid var(--primary-mint-border);
}

/* ==========================================================================
   CENTRAL DE QUALIDADE DO LOTE & INGESTÃO CONTROLADA (FASE 3)
   ========================================================================== */

.batch-stepper-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  gap: 12px;
}

.batch-step-item {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  opacity: 0.55;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.batch-step-item.active {
  opacity: 1;
}

.batch-step-item.completed {
  opacity: 0.9;
}

.step-num {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-surface-alt);
  border: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.batch-step-item.active .step-num {
  background: var(--primary-emerald);
  border-color: var(--primary-emerald);
  color: #FFFFFF;
  box-shadow: 0 0 0 4px rgba(5, 150, 105, 0.15);
}

.batch-step-item.completed .step-num {
  background: #10B981;
  border-color: #10B981;
  color: #FFFFFF;
}

.step-label {
  display: flex;
  flex-direction: column;
}

.step-label strong {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 700;
}

.step-label span {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.step-divider {
  width: 40px;
  height: 2px;
  background: var(--border-color);
  flex-shrink: 0;
}

.quality-metrics-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-top: 16px;
}

.q-metric-card {
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 14px 12px;
  text-align: center;
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.q-metric-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary-emerald);
}

.q-metric-card .q-val {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.q-metric-card .q-lbl {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 600;
}

.q-metric-card.positive {
  background: var(--accent-sesc-sky-bg);
  border-color: var(--primary-mint-border);
}

.q-metric-card.positive .q-val {
  color: var(--primary-sesc-dark);
}

.q-metric-card.warning {
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.25);
}

.q-metric-card.warning .q-val {
  color: #B45309;
}

.q-metric-card.alert {
  background: rgba(239, 68, 68, 0.07);
  border-color: rgba(239, 68, 68, 0.25);
}

.q-metric-card.alert .q-val {
  color: #B91C1C;
}

.q-metric-card.neutral {
  background: rgba(37, 99, 235, 0.07);
  border-color: rgba(37, 99, 235, 0.25);
}

.q-metric-card.neutral .q-val {
  color: #1D4ED8;
}

@media (max-width: 900px) {
  .quality-metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .batch-stepper-card {
    flex-direction: column;
    align-items: flex-start;
  }
  .step-divider {
    display: none;
  }
}

/* ==========================================================================
   MÓDULO DE RASTREABILIDADE SANITÁRIA POR LOTE & FEFO (FASE 4)
   Conformidade: Lei Federal nº 15.224/2025 (PNCPDA) e Anvisa RDC nº 216/2004
   ========================================================================== */

.badge-anvisa-conformidade {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: rgba(5, 150, 105, 0.1);
  border: 1px solid rgba(5, 150, 105, 0.35);
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 700;
  color: #065F46;
}

[data-theme="dark"] .badge-anvisa-conformidade {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.4);
  color: #34D399;
}

.sanitary-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.sanitary-kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.sanitary-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-emerald);
}

.sanitary-kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary-emerald);
}

.sanitary-kpi-card.urgent::before {
  background: #EF4444;
}

.sanitary-kpi-card.alert::before {
  background: #F59E0B;
}

.sanitary-kpi-card.success::before {
  background: #10B981;
}

.sanitary-kpi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.sanitary-kpi-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.sanitary-kpi-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 12px;
  text-transform: uppercase;
}

.sanitary-kpi-badge.urgent {
  background: #FEE2E2;
  color: #B91C1C;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.sanitary-kpi-badge.alert {
  background: #FEF3C7;
  color: #B45309;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.sanitary-kpi-badge.success {
  background: #D1FAE5;
  color: #065F46;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.sanitary-kpi-value {
  font-size: 26px;
  font-weight: 800;
  font-family: 'Plus Jakarta Sans', sans-serif;
  color: var(--text-primary);
  line-height: 1.1;
  margin-bottom: 6px;
}

.sanitary-kpi-subtext {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Painel da Cadeia de Custódia (Timeline do Lote) */
.custody-timeline-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-sm);
}

.custody-timeline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 12px;
}

.custody-lot-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 800;
  padding: 6px 14px;
  background: rgba(5, 150, 105, 0.1);
  color: var(--primary-emerald);
  border: 1px solid rgba(5, 150, 105, 0.3);
  border-radius: 6px;
  font-family: 'Courier New', monospace;
}

.custody-timeline-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  position: relative;
}

.custody-step {
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 14px 14px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.18s ease, transform 0.18s ease;
}

.custody-step:hover {
  border-color: var(--primary-emerald);
  transform: translateY(-2px);
}

.custody-step-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.custody-step-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: #FFFFFF;
  flex-shrink: 0;
}

.custody-step-icon.step-1 { background: #3B82F6; }
.custody-step-icon.step-2 { background: #10B981; }
.custody-step-icon.step-3 { background: #F59E0B; }
.custody-step-icon.step-4 { background: #8B5CF6; }

.custody-step-title {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.custody-step-sub {
  font-size: 10px;
  color: var(--text-muted);
}

.custody-detail-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
  border-top: 1px dashed var(--border-color);
  padding-top: 8px;
}

.custody-detail-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
}

.custody-detail-row .lbl {
  color: var(--text-muted);
}

.custody-detail-row .val {
  font-weight: 700;
  color: var(--text-primary);
  text-align: right;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Barra de Filtro FEFO & Busca */
.fefo-toolbar-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.fefo-filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.fefo-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--border-color);
  background: var(--bg-surface-alt);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.18s ease;
}

.fefo-pill-btn:hover {
  border-color: var(--primary-emerald);
  color: var(--primary-emerald);
}

.fefo-pill-btn.active {
  background: var(--primary-emerald);
  color: #FFFFFF;
  border-color: var(--primary-emerald);
}

.fefo-pill-btn.active.urgent-btn {
  background: #EF4444;
  border-color: #EF4444;
}

.fefo-pill-btn.active.alert-btn {
  background: #F59E0B;
  border-color: #F59E0B;
}

.fefo-pill-btn.active.stable-btn {
  background: #10B981;
  border-color: #10B981;
}

.fefo-pill-badge {
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 10px;
  background: rgba(0, 0, 0, 0.08);
}

.fefo-pill-btn.active .fefo-pill-badge {
  background: rgba(255, 255, 255, 0.25);
  color: #FFFFFF;
}

.fefo-search-box {
  display: flex;
  align-items: center;
  position: relative;
  min-width: 280px;
}

.fefo-search-box i {
  position: absolute;
  left: 10px;
  color: var(--text-muted);
  font-size: 14px;
}

.fefo-search-input {
  width: 100%;
  padding: 7px 12px 7px 32px;
  font-size: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-primary);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.fefo-search-input:focus {
  outline: none;
  border-color: var(--primary-emerald);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
}

/* Badges de Lote e Criticidade na Tabela */
.fefo-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
}

.fefo-badge.urgente {
  background: rgba(239, 68, 68, 0.12);
  color: #DC2626;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.fefo-badge.alerta {
  background: rgba(245, 158, 11, 0.12);
  color: #D97706;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.fefo-badge.estavel {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.btn-inspect-lot {
  padding: 4px 9px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface-alt);
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.18s ease;
}

.btn-inspect-lot:hover {
  background: var(--primary-emerald);
  color: #FFFFFF;
  border-color: var(--primary-emerald);
}

/* Modal da Ficha Sanitária do Lote */
.sanitary-modal-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  max-width: 760px;
  width: 94vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  animation: modalScaleIn 0.22s ease-out;
}

.sanitary-laudo-box {
  background: rgba(5, 150, 105, 0.05);
  border: 1px solid rgba(5, 150, 105, 0.2);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin-top: 14px;
}

@media (max-width: 1024px) {
  .sanitary-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .custody-timeline-steps {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .sanitary-kpi-grid {
    grid-template-columns: 1fr;
  }
  .custody-timeline-steps {
    grid-template-columns: 1fr;
  }
  .fefo-toolbar-card {
    flex-direction: column;
    align-items: stretch;
  }
  .fefo-search-box {
    width: 100%;
    min-width: unset;
  }
}

/* ==========================================================================
   FASE 5: PORTAL DO DOADOR 360° & VALIDAÇÃO PÚBLICA COM QR CODE
   ========================================================================== */

/* Validação Digital & QR Code no Certificado */
.cert-qr-validation-row {
  margin-top: 14px;
  padding: 10px 16px;
  background: rgba(5, 150, 105, 0.04);
  border: 1px dashed rgba(5, 150, 105, 0.35);
  border-radius: var(--radius-sm);
}

.cert-qr-container {
  display: flex;
  align-items: center;
  gap: 16px;
}

.cert-qr-box {
  width: 72px;
  height: 72px;
  background: #FFFFFF;
  padding: 4px;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cert-qr-box img,
.cert-qr-box canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.cert-qr-desc {
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-align: left;
}

.cert-qr-seal {
  font-size: 11px;
  font-weight: 800;
  color: #065F46;
  display: flex;
  align-items: center;
  gap: 5px;
  letter-spacing: 0.5px;
}

.cert-qr-instructions {
  font-size: 11px;
  color: #4B5563;
  line-height: 1.3;
}

.cert-qr-url {
  font-size: 11px;
  font-family: monospace;
  font-weight: 700;
  color: #047857;
  word-break: break-all;
}

/* Painel Doador 360° */
.donor-360-header-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.donor-360-back-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.btn-back-clean {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.btn-back-clean:hover {
  background: var(--bg-surface-alt);
  color: var(--primary-emerald);
  border-color: var(--primary-emerald);
}

.donor-360-identity-row {
  display: flex;
  align-items: center;
  gap: 20px;
}

.donor-360-avatar {
  width: 60px;
  height: 60px;
  border-radius: 12px;
  background: linear-gradient(135deg, #065F46 0%, #059669 100%);
  color: #FFFFFF;
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.25);
}

.donor-360-title-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.donor-360-badge-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.donor-hash-badge {
  font-family: monospace;
  font-size: 11px;
  font-weight: 700;
  background: rgba(37, 99, 235, 0.1);
  color: #2563EB;
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.donor-unit-badge {
  font-size: 11px;
  font-weight: 600;
  background: var(--bg-surface-alt);
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

.donor-360-name {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: -0.5px;
}

.donor-360-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.donor-360-meta .meta-divider {
  color: var(--border-color);
}

/* Grid de 6 KPIs do Doador 360° */
.donor-kpi-grid-6 {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.donor-kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.donor-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.donor-kpi-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  margin-bottom: 8px;
}

.donor-kpi-icon.icon-kg { background: rgba(5, 150, 105, 0.12); color: #059669; }
.donor-kpi-icon.icon-meals { background: rgba(217, 119, 6, 0.12); color: #D97706; }
.donor-kpi-icon.icon-co2 { background: rgba(37, 99, 235, 0.12); color: #2563EB; }
.donor-kpi-icon.icon-trees { background: rgba(16, 185, 129, 0.12); color: #10B981; }
.donor-kpi-icon.icon-water { background: rgba(6, 182, 212, 0.12); color: #06B6D4; }
.donor-kpi-icon.icon-cost { background: rgba(139, 92, 246, 0.12); color: #8B5CF6; }

.donor-kpi-val {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}

.donor-kpi-lbl {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 4px;
}

/* Grid Duplo 360° */
.donor-detail-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* Barras de Mix Nutricional */
.nova-progress-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.nova-progress-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nova-progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.nova-progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-surface-alt);
  border-radius: 4px;
  overflow: hidden;
}

.nova-progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}

.nova-progress-fill.in-natura { background: #059669; }
.nova-progress-fill.minimamente { background: #10B981; }
.nova-progress-fill.processado { background: #F59E0B; }
.nova-progress-fill.ultra { background: #EF4444; }

/* Tag Cloud de Cidades */
.donor-cities-tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 120px;
  overflow-y: auto;
  padding: 2px;
}

.donor-city-tag {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 12px;
  background: rgba(5, 150, 105, 0.08);
  color: #065F46;
  font-weight: 600;
  border: 1px solid rgba(5, 150, 105, 0.2);
}

/* Gráfico de Barras Histórico */
.donor-history-chart-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 180px;
  padding: 20px 8px 10px 8px;
  overflow-x: auto;
}

.donor-history-bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 44px;
  flex-shrink: 0;
  height: 100%;
  justify-content: flex-end;
}

.donor-bar-pill {
  width: 24px;
  background: linear-gradient(180deg, #3B82F6 0%, #1D4ED8 100%);
  border-radius: 4px 4px 0 0;
  transition: height 0.3s ease;
  position: relative;
}

.donor-bar-pill:hover {
  background: linear-gradient(180deg, #60A5FA 0%, #2563EB 100%);
}

.donor-bar-lbl {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
}

.donor-bar-val {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-secondary);
}

/* Modal de Validação Pública */
.public-validation-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  max-width: 620px;
  width: 92vw;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  animation: modalScaleIn 0.22s ease-out;
  overflow: hidden;
}

.public-val-header {
  padding: 24px 28px 16px 28px;
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(135deg, rgba(5, 150, 105, 0.08) 0%, rgba(16, 185, 129, 0.02) 100%);
  border-bottom: 1px solid var(--border-color);
}

.public-val-seal-badge {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #059669;
  color: #FFFFFF;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(5, 150, 105, 0.3);
}

.public-val-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0;
}

.public-val-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin: 2px 0 0 0;
}

.public-val-body {
  padding: 20px 28px;
}

.public-val-alert-box {
  background: rgba(5, 150, 105, 0.08);
  border: 1px solid rgba(5, 150, 105, 0.25);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 12px;
  color: #065F46;
  line-height: 1.4;
  margin-bottom: 18px;
}

.public-val-alert-box i {
  font-size: 18px;
  color: #059669;
  flex-shrink: 0;
  margin-top: 1px;
}

.public-val-details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  background: var(--bg-surface-alt);
  padding: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.public-val-details-grid .val-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.public-val-details-grid .lbl {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.public-val-details-grid .val {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 600;
}

.public-val-details-grid .val.strong {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-primary);
}

.public-val-details-grid .val.highlight {
  font-size: 14px;
  font-weight: 800;
  color: #059669;
}

.public-val-details-grid .val.code {
  font-family: monospace;
  font-size: 12px;
  font-weight: 700;
  color: #2563EB;
}

.public-val-legal-text {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 14px;
  line-height: 1.4;
  display: flex;
  align-items: center;
  gap: 6px;
}

.public-val-footer {
  padding: 14px 28px;
  background: var(--bg-surface-alt);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

@media (max-width: 1024px) {
  .donor-kpi-grid-6 {
    grid-template-columns: repeat(3, 1fr);
  }
  .donor-detail-grid-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .donor-kpi-grid-6 {
    grid-template-columns: repeat(2, 1fr);
  }
  .public-val-details-grid {
    grid-template-columns: 1fr;
  }
  .cert-qr-container {
    flex-direction: column;
    text-align: center;
  }
  .cert-qr-desc {
    text-align: center;
  }
}

/* ==========================================================================
   FASE 6: MOTOR PREDITIVO DE DESPACHO & IA DE ALOCAÇÃO DE DEMANDA (SAR)
   ========================================================================== */

/* Banner de Alerta Preditivo na Visão Executiva */
.ai-dispatch-alert-banner {
  background: linear-gradient(135deg, rgba(5, 150, 105, 0.08) 0%, rgba(37, 99, 235, 0.08) 100%);
  border: 1px solid rgba(5, 150, 105, 0.25);
  border-radius: var(--radius-md);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 16px;
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.06);
}

.ai-banner-content {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text-primary);
}

.ai-banner-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #059669 0%, #2563EB 100%);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.25);
}

.btn-ai-banner-action {
  background: var(--bg-surface);
  border: 1px solid rgba(5, 150, 105, 0.3);
  color: var(--primary-emerald);
  font-size: 12px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.btn-ai-banner-action:hover {
  background: var(--primary-emerald);
  color: #FFFFFF;
  border-color: var(--primary-emerald);
}

/* Card Principal da IA no Módulo FEFO */
.dispatch-ai-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  position: relative;
}

.dispatch-ai-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #059669 0%, #2563EB 50%, #10B981 100%);
}

.dispatch-ai-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-surface-alt);
}

.dispatch-ai-icon-pulse {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(5, 150, 105, 0.12);
  color: #059669;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.sar-ai-tag {
  font-size: 10px;
  font-weight: 800;
  background: linear-gradient(135deg, #059669 0%, #2563EB 100%);
  color: #FFFFFF;
  padding: 2px 7px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  letter-spacing: 0.5px;
}

.dispatch-ai-body {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 20px;
  padding: 20px;
}

/* Coluna 1: Recomendação Primária */
.dispatch-primary-recommendation {
  background: rgba(5, 150, 105, 0.03);
  border: 1px solid rgba(5, 150, 105, 0.2);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.dispatch-rec-badge {
  font-size: 11px;
  font-weight: 800;
  color: #065F46;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  letter-spacing: 0.5px;
}

.dispatch-entity-header {
  display: flex;
  align-items: center;
  gap: 14px;
}

.dispatch-entity-avatar {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: #059669;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.25);
}

.dispatch-entity-name {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0;
}

.dispatch-entity-meta {
  font-size: 11.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  flex-wrap: wrap;
}

.dispatch-entity-meta .meta-dot {
  color: var(--border-color);
}

.dispatch-score-box {
  background: #FFFFFF;
  border: 1px solid rgba(5, 150, 105, 0.3);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  flex-shrink: 0;
}

.sar-score-val {
  font-size: 20px;
  font-weight: 800;
  color: #059669;
  line-height: 1;
}

.sar-score-lbl {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-top: 2px;
}

/* 4 Pilares do SAR */
.sar-breakdown-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.sar-pillar {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sar-p-lbl {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
}

.sar-p-bar {
  width: 100%;
  height: 5px;
  background: var(--bg-surface-alt);
  border-radius: 3px;
  overflow: hidden;
}

.sar-p-fill {
  height: 100%;
  background: #059669;
  border-radius: 3px;
  transition: width 0.3s ease;
}

.sar-p-fill.urgent {
  background: #DC2626;
}

.sar-p-sub {
  font-size: 9.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.dispatch-justification-box {
  background: rgba(5, 150, 105, 0.06);
  border: 1px solid rgba(5, 150, 105, 0.15);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 11.5px;
  color: #065F46;
  line-height: 1.4;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.dispatch-justification-box i {
  font-size: 14px;
  color: #059669;
  flex-shrink: 0;
  margin-top: 1px;
}

/* Coluna 2: Contingência */
.dispatch-contingency-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dispatch-contingency-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.dispatch-contingency-sub {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.3;
  margin: 0;
}

.contingency-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.contingency-item {
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  transition: all 0.15s ease;
  cursor: pointer;
}

.contingency-item:hover {
  border-color: var(--primary-emerald);
  background: var(--bg-surface);
}

.contingency-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.contingency-item-name {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-primary);
}

.contingency-item-meta {
  font-size: 10.5px;
  color: var(--text-muted);
}

.contingency-item-score {
  font-size: 13px;
  font-weight: 800;
  color: #2563EB;
  background: rgba(37, 99, 235, 0.1);
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

/* Modal e Folha da Guia de Despacho */
.dispatch-guide-modal-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  max-width: 820px;
  width: 95vw;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  animation: modalScaleIn 0.22s ease-out;
}

.dispatch-guide-body-wrapper {
  padding: 20px;
  background: #F1F5F9;
  display: flex;
  justify-content: center;
}

.dispatch-guide-sheet {
  background: #FFFFFF;
  border-radius: 4px;
  padding: 32px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  width: 100%;
  max-width: 760px;
  border: 1px solid #E2E8F0;
  display: flex;
  flex-direction: column;
  gap: 20px;
  color: #1E293B;
  font-family: 'Inter', sans-serif;
}

.guide-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid #059669;
  padding-bottom: 16px;
  gap: 16px;
}

.guide-logo-img {
  height: 48px;
  width: auto;
}

.guide-title-col {
  text-align: center;
  flex: 1;
}

.guide-title-col h2 {
  font-size: 16px;
  font-weight: 800;
  color: #002D62;
  margin: 0;
  letter-spacing: 0.5px;
}

.guide-sub-title {
  font-size: 10.5px;
  font-weight: 700;
  color: #64748B;
  margin-top: 2px;
}

.guide-law-badge {
  font-size: 9.5px;
  font-weight: 800;
  color: #059669;
  background: rgba(5, 150, 105, 0.08);
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-block;
  margin-top: 4px;
}

.guide-qr-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.guide-qr-box {
  width: 52px;
  height: 52px;
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  padding: 2px;
  border-radius: 4px;
}

.guide-qr-box img,
.guide-qr-box canvas {
  width: 100% !important;
  height: 100% !important;
}

.guide-odp-code {
  font-family: monospace;
  font-size: 10px;
  font-weight: 800;
  color: #065F46;
}

.guide-data-section {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 6px;
  padding: 14px 16px;
}

.guide-sec-title {
  font-size: 12px;
  font-weight: 800;
  color: #0F172A;
  margin: 0 0 10px 0;
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.guide-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  font-size: 11.5px;
}

.guide-grid-3 .lbl {
  color: #64748B;
  display: block;
  font-size: 10px;
}

.guide-legal-p {
  font-size: 11px;
  color: #475569;
  line-height: 1.45;
  margin: 0;
}

.guide-signatures-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 10px;
  padding-top: 10px;
}

.guide-sig-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.guide-sig-item .sig-line {
  width: 80%;
  border-top: 1px solid #475569;
  margin-bottom: 6px;
}

.guide-sig-item .sig-title {
  font-size: 11px;
  font-weight: 700;
  color: #0F172A;
}

.guide-sig-item .sig-sub {
  font-size: 9.5px;
  color: #64748B;
}

@media (max-width: 1024px) {
  .dispatch-ai-body {
    grid-template-columns: 1fr;
  }
  .sar-breakdown-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .ai-dispatch-alert-banner {
    flex-direction: column;
    align-items: flex-start;
  }
  .guide-header-top {
    flex-direction: column;
    text-align: center;
  }
  .guide-grid-3 {
    grid-template-columns: 1fr;
  }
  .guide-signatures-row {
    grid-template-columns: 1fr;
    gap: 30px;
  }
}




