/* ============================================================
   GPON Module — Corporate Dashboard CSS
   Tema: Purple (integrado ao Radar)
   ============================================================ */

:root {
  --gpon-primary: #7c3aed;
  --gpon-primary-dark: #5b21b6;
  --gpon-primary-light: #a855f7;
  --gpon-accent: #0ea5e9;
  --gpon-accent-dark: #0369a1;
  --gpon-bg: #f0ecff;
  --gpon-surface: #ffffff;
  --gpon-border: #e5e0fb;
  --gpon-text: #1e1b4b;
  --gpon-muted: #6b7280;
  --gpon-success: #16a34a;
  --gpon-warning: #d97706;
  --gpon-danger: #dc2626;
  --gpon-info: #0284c7;
  --gpon-sidebar-w: 260px;
  --gpon-header-h: 56px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .08);
  --shadow-md: 0 4px 16px rgba(124, 58, 237, .12);
  --shadow-lg: 0 8px 32px rgba(124, 58, 237, .16);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

/* ── RESET ───────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  background: var(--gpon-bg);
  color: var(--gpon-text);
}

/* ── TOPBAR ──────────────────────────────────────────────── */
.gpon-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--gpon-header-h);
  background: linear-gradient(135deg, #3b0764 0%, #5b21b6 55%, #7c3aed 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-logo-icon {
  font-size: 22px;
  cursor: pointer;
}

.topbar-brand {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.topbar-brand .brand-title {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  letter-spacing: .5px;
}

.topbar-brand .brand-sub {
  font-size: 10px;
  color: #d8b4fe;
  font-weight: 500;
}

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

/* ── TOPBAR BUTTONS ──────────────────────────────────────── */
.tbtn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .1);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, border-color .15s;
  white-space: nowrap;
}

.tbtn:hover {
  background: rgba(255, 255, 255, .2);
  border-color: rgba(255, 255, 255, .45);
  color: #fff;
}

.tbtn.primary {
  background: #7c3aed;
  border-color: #6d28d9;
}

.tbtn.primary:hover {
  background: #6d28d9;
}

.tbtn.success {
  background: #16a34a;
  border-color: #15803d;
}

.tbtn.success:hover {
  background: #15803d;
}

.tbtn.danger {
  background: rgba(220, 38, 38, .15);
  border-color: rgba(220, 38, 38, .4);
}

.tbtn.danger:hover {
  background: rgba(220, 38, 38, .25);
  border-color: rgba(220, 38, 38, .6);
}

.tbtn.gpon-accent {
  background: linear-gradient(135deg, #0ea5e9, #0369a1);
  border-color: #0369a1;
}

.tbtn.gpon-accent:hover {
  background: linear-gradient(135deg, #0284c7, #075985);
}

.tbtn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* ── TOPBAR ICON-ONLY BUTTONS (Eficiência / Análise / Importar) ── */
.tbtn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  justify-content: center;
  gap: 0;
}

.tbtn-icon i {
  font-size: 15px;
}

.tbtn-icon span {
  display: none;
}

.tbtn-icon.active {
  background: rgba(255, 255, 255, .28);
  border-color: rgba(255, 255, 255, .55);
}

/* ── USER BADGE ──────────────────────────────────────────── */
.user-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 20px;
  background: rgba(255, 255, 255, .1);
  color: #fff;
  font-size: 13px;
}

.user-badge i {
  font-size: 16px;
}

.user-badge-admin {
  color: #fbbf24;
  text-decoration: none;
  font-size: 14px;
}

.user-badge-admin:hover {
  color: #fde68a;
}

/* ── TOPBAR LAST UPDATE ──────────────────────────────────── */
.topbar-last-update {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .1);
  font-size: 11px;
  color: rgba(255, 255, 255, .65);
  font-weight: 600;
  white-space: nowrap;
  font-family: 'IBM Plex Mono', monospace;
  letter-spacing: .01em;
  transition: background .2s, color .2s;
}

.topbar-last-update i {
  color: #38bdf8;
  font-size: 13px;
  flex-shrink: 0;
}

.topbar-last-update:hover {
  background: rgba(255, 255, 255, .12);
  color: rgba(255, 255, 255, .9);
}

.topbar-last-update.stale {
  color: #fbbf24;
}

.topbar-last-update.stale i {
  color: #fbbf24;
}

@media (max-width: 768px) {
  .topbar-last-update {
    display: none;
  }
}

.logout-btn {
  color: #fca5a5;
  text-decoration: none;
  font-size: 14px;
  margin-left: 2px;
}

.logout-btn:hover {
  color: #f87171;
}

/* ── LAYOUT ──────────────────────────────────────────────── */
.gpon-layout {
  display: flex;
  margin-top: var(--gpon-header-h);
  min-height: calc(100vh - var(--gpon-header-h));
}

/* ── SIDEBAR ─────────────────────────────────────────────── */
.gpon-sidebar {
  width: var(--gpon-sidebar-w);
  min-height: calc(100vh - var(--gpon-header-h));
  background: linear-gradient(180deg, #faf8ff 0%, #f3efff 100%);
  border-right: 1px solid rgba(139, 92, 246, .18);
  padding: 14px 10px;
  overflow-y: auto;
  position: sticky;
  top: var(--gpon-header-h);
  height: calc(100vh - var(--gpon-header-h));
  flex-shrink: 0;
  transition: width .2s, opacity .2s;
  scrollbar-width: thin;
  scrollbar-color: rgba(139, 92, 246, .22) transparent;
}

.gpon-sidebar::-webkit-scrollbar {
  width: 4px;
}

.gpon-sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.gpon-sidebar::-webkit-scrollbar-thumb {
  background: rgba(139, 92, 246, .22);
  border-radius: 4px;
}

.gpon-sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(139, 92, 246, .42);
}

.gpon-sidebar.collapsed {
  width: 0;
  padding: 0;
  overflow: hidden;
  opacity: 0;
}

/* ── SIDEBAR NAV (menu de módulos — genérico, reaproveitável por
   qualquer página; mesmo padrão visual do .admin-nav de admin.css,
   nomeado sem prefixo "admin" por não ser exclusivo do painel admin) ── */
.gpon-sidebar.nav-sidebar {
  padding: 16px 10px;
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.nav-section-title {
  display: block;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #6d28d9;
  padding: 0 8px 8px;
  border-bottom: 1px solid rgba(139, 92, 246, .18);
  margin-bottom: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border-radius: 8px;
  border-left: 3px solid transparent;
  color: var(--gpon-text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: 2px;
  transition: background .15s, color .15s, border-left-color .15s;
  user-select: none;
}

.nav-item i {
  font-size: 15px;
  color: #7c3aed;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  transition: color .15s;
}

.nav-item:hover:not(.disabled) {
  background: rgba(139, 92, 246, .09);
  color: var(--gpon-primary);
  border-left-color: rgba(124, 58, 237, .3);
  text-decoration: none;
}

.nav-item.active {
  background: rgba(139, 92, 246, .13);
  color: var(--gpon-primary);
  border-left-color: var(--gpon-primary);
  font-weight: 600;
}

.nav-item.active i {
  color: var(--gpon-primary);
}

.nav-item.disabled {
  opacity: .4;
  cursor: default;
  pointer-events: none;
}

.nav-soon .nav-section-title {
  color: #9ca3af;
  border-bottom-color: rgba(156, 163, 175, .2);
}

.nav-soon .nav-item i {
  color: #9ca3af;
}

/* ── SIDEBAR FILTERS (sf) ────────────────────────────────── */
.sf-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px 10px;
  border-bottom: 1px solid rgba(139, 92, 246, .16);
  margin-bottom: 10px;
}

.sf-header-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .9px;
  color: #6d28d9;
  display: flex;
  align-items: center;
  gap: 5px;
}

.sf-header-title i {
  color: #7c3aed;
  font-size: 13px;
}

.sf-clear-all {
  background: none;
  border: none;
  color: rgba(109, 40, 217, .35);
  font-size: 15px;
  cursor: pointer;
  padding: 2px 3px;
  border-radius: 4px;
  line-height: 1;
  transition: color .15s;
}

.sf-clear-all:hover {
  color: #dc2626;
}

.sf-cards {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sf-card {
  border: 1px solid rgba(139, 92, 246, .13);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 2px 8px rgba(109, 40, 217, .05);
  transition: border-color .2s, box-shadow .2s;
}

.sf-card:not(.sf-collapsed) {
  border-color: rgba(124, 58, 237, .32);
  box-shadow: 0 4px 14px rgba(109, 40, 217, .09);
}

.sf-card-header {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  background: none;
  border: none;
  padding: 9px 11px;
  cursor: pointer;
  text-align: left;
  transition: background .15s;
}

.sf-card:not(.sf-collapsed) .sf-card-header {
  background: linear-gradient(90deg, rgba(139, 92, 246, .07), rgba(139, 92, 246, .02));
}

.sf-card-header:hover {
  background: rgba(139, 92, 246, .07);
}

.sf-card-icon {
  font-size: 13px;
  color: #7c3aed;
  flex-shrink: 0;
}

.sf-card-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: #3b2166;
  flex: 1;
}

.sf-badge {
  display: none;
  background: linear-gradient(135deg, #6d28d9, #a855f7);
  color: #fff;
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 9px;
  font-weight: 700;
  flex-shrink: 0;
  line-height: 1.6;
  box-shadow: 0 2px 6px rgba(109, 40, 217, .3);
}

.sf-badge.visible {
  display: inline-block;
}

.sf-chevron {
  font-size: 10px;
  color: rgba(109, 40, 217, .4);
  flex-shrink: 0;
  transition: transform .22s ease;
}

.sf-card:not(.sf-collapsed) .sf-chevron {
  transform: rotate(180deg);
}

.sf-card-body {
  border-top: 1px solid rgba(139, 92, 246, .1);
  max-height: 300px;
  overflow: hidden;
  transition: max-height .22s ease, opacity .18s;
  opacity: 1;
}

.sf-card-body.collapsed {
  max-height: 0;
  border-top-color: transparent;
  opacity: 0;
}

/* Search */
.sf-search-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-bottom: 1px solid rgba(139, 92, 246, .1);
  background: rgba(139, 92, 246, .04);
  transition: background .15s, box-shadow .15s;
}

.sf-search-wrap:focus-within {
  background: rgba(139, 92, 246, .09);
  box-shadow: inset 0 -2px 0 rgba(109, 40, 217, .35);
}

.sf-search-wrap i {
  font-size: 10px;
  color: rgba(109, 40, 217, .38);
  flex-shrink: 0;
  transition: color .15s;
}

.sf-search-wrap:focus-within i {
  color: #7c3aed;
}

.sf-search {
  border: none;
  background: none;
  outline: none;
  font-size: 11px;
  color: var(--gpon-text);
  width: 100%;
}

.sf-search::placeholder {
  color: rgba(109, 40, 217, .32);
}

/* List with custom scrollbar */
.sf-list {
  overflow-y: auto;
  max-height: 220px;
  padding: 4px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(139, 92, 246, .18) transparent;
}

.sf-list::-webkit-scrollbar {
  width: 3px;
}

.sf-list::-webkit-scrollbar-track {
  background: transparent;
}

.sf-list::-webkit-scrollbar-thumb {
  background: rgba(139, 92, 246, .18);
  border-radius: 3px;
}

/* Items */
.sf-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  cursor: pointer;
  transition: background .12s, border-left-color .12s;
  user-select: none;
  min-height: 28px;
  border-left: 2px solid transparent;
}

.sf-item:hover {
  background: rgba(139, 92, 246, .07);
  border-left-color: rgba(124, 58, 237, .28);
}

.sf-item.active {
  background: rgba(139, 92, 246, .11);
  border-left-color: #7c3aed;
}

/* Custom checkbox */
.sf-check {
  width: 14px;
  height: 14px;
  border: 1.5px solid #c4b5fd;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all .15s;
  background: #fff;
}

.sf-check i {
  font-size: 9px;
  color: #fff;
  display: none;
}

.sf-item:hover .sf-check {
  border-color: #8b5cf6;
}

.sf-item.active .sf-check {
  background: linear-gradient(135deg, #6d28d9, #8b5cf6);
  border-color: #6d28d9;
  box-shadow: 0 2px 5px rgba(109, 40, 217, .3);
}

.sf-item.active .sf-check i {
  display: block;
}

.sf-item-label {
  font-size: 11px;
  color: #374151;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
  transition: color .12s;
}

.sf-item:hover .sf-item-label {
  color: #4c1d95;
}

.sf-item.active .sf-item-label {
  color: #5b21b6;
  font-weight: 600;
}

.sf-item-count {
  font-size: 10px;
  color: #9ca3af;
  font-family: 'IBM Plex Mono', monospace;
  flex-shrink: 0;
  background: rgba(139, 92, 246, .08);
  border-radius: 8px;
  padding: 0 5px;
  line-height: 1.6;
  transition: background .12s, color .12s;
}

.sf-item:hover .sf-item-count {
  background: rgba(139, 92, 246, .14);
  color: #6d28d9;
}

.sf-item.active .sf-item-count {
  background: rgba(109, 40, 217, .16);
  color: #5b21b6;
  font-weight: 600;
}

/* Footer */
.sf-footer {
  margin-top: 10px;
  padding: 9px 4px 4px;
  border-top: 1px solid rgba(139, 92, 246, .13);
}

.sf-active-info {
  font-size: 10px;
  color: rgba(109, 40, 217, .38);
  text-align: center;
  font-style: italic;
}

.sf-active-info.has-filters {
  color: #6d28d9;
  font-style: normal;
  font-weight: 700;
  letter-spacing: .3px;
}

/* ── MAIN CONTENT ────────────────────────────────────────── */
.gpon-main {
  flex: 1;
  padding: 20px;
  overflow: hidden;
}

/* ── KPI CARDS ───────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 6px;
  margin-bottom: 10px;
}

.kpi-card {
  background: var(--gpon-surface);
  border: 1px solid var(--gpon-border);
  border-radius: 8px;
  padding: .35rem .6rem .4rem;
  display: flex;
  flex-direction: column;
  gap: 1px;
  box-shadow: 0 1px 2px rgba(76, 29, 149, .08);
  transition: border-color .15s, transform .15s, box-shadow .15s;
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: 8px 8px 0 0;
}

.kpi-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(76, 29, 149, .10);
}

.kpi-card-filterable {
  cursor: pointer;
  transition: transform .15s, box-shadow .15s, border-color .15s, background .15s;
}

.kpi-card-filterable:hover {
  border-color: var(--gpon-primary);
}

.kpi-card-filterable.kpi-active {
  border-color: var(--gpon-primary);
  background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
  box-shadow: 0 0 0 2px rgba(124, 58, 237, .25);
}

.kpi-card .kpi-label {
  font-size: .58rem;
  color: var(--gpon-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .09em;
  margin-bottom: 1px;
}

.kpi-card .kpi-value {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1;
  font-family: 'IBM Plex Mono', monospace;
}

.kpi-card .kpi-sub {
  font-size: .6rem;
  color: var(--gpon-muted);
  margin-top: 2px;
  line-height: 1.3;
}

.kpi-card .kpi-icon {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.5rem;
  opacity: .14;
}

/* Abertas — purple */
.kpi-card[data-type="abertas"] {
  background: linear-gradient(135deg, #f5f3ff 60%, #ede9fe 100%);
  border-color: #c4b5fd;
}

.kpi-card[data-type="abertas"]::before {
  background: linear-gradient(90deg, #7c3aed, #a855f7);
}

.kpi-card[data-type="abertas"] .kpi-value {
  color: #7c3aed;
}

.kpi-card[data-type="abertas"] .kpi-icon {
  color: #7c3aed;
}

/* Empresas — teal */
.kpi-card[data-type="empresas"] {
  background: linear-gradient(135deg, #f0fdfa 60%, #99f6e4 100%);
  border-color: #5eead4;
}

.kpi-card[data-type="empresas"]::before {
  background: linear-gradient(90deg, #14b8a6, #06b6d4);
}

.kpi-card[data-type="empresas"] .kpi-value {
  color: #0e7490;
}

.kpi-card[data-type="empresas"] .kpi-icon {
  color: #14b8a6;
}

/* Fora do Prazo — red */
.kpi-card[data-type="atraso"] {
  background: linear-gradient(135deg, #fff1f2 60%, #fecdd3 100%);
  border-color: #fca5a5;
}

.kpi-card[data-type="atraso"]::before {
  background: linear-gradient(90deg, #dc2626, #f87171);
}

.kpi-card[data-type="atraso"] .kpi-value {
  color: #dc2626;
}

.kpi-card[data-type="atraso"] .kpi-icon {
  color: #dc2626;
}

/* Dentro do Prazo — green */
.kpi-card[data-type="prazo"] {
  background: linear-gradient(135deg, #f0fdf4 60%, #bbf7d0 100%);
  border-color: #86efac;
}

.kpi-card[data-type="prazo"]::before {
  background: linear-gradient(90deg, #16a34a, #34d399);
}

.kpi-card[data-type="prazo"] .kpi-value {
  color: #16a34a;
}

.kpi-card[data-type="prazo"] .kpi-icon {
  color: #16a34a;
}

/* Atenção — amber */
.kpi-card[data-type="proximo"] {
  background: linear-gradient(135deg, #fff7ed 60%, #fed7aa 100%);
  border-color: #fdba74;
}

.kpi-card[data-type="proximo"]::before {
  background: linear-gradient(90deg, #ea580c, #f97316);
}

.kpi-card[data-type="proximo"] .kpi-value {
  color: #ea580c;
}

.kpi-card[data-type="proximo"] .kpi-icon {
  color: #ea580c;
}

/* Repetidas — pink */
.kpi-card[data-type="repetidas"] {
  background: linear-gradient(135deg, #fdf2f8 60%, #fce7f3 100%);
  border-color: #f9a8d4;
}

.kpi-card[data-type="repetidas"]::before {
  background: linear-gradient(90deg, #be185d, #f472b6);
}

.kpi-card[data-type="repetidas"] .kpi-value {
  color: #be185d;
}

.kpi-card[data-type="repetidas"] .kpi-icon {
  color: #be185d;
}

/* Empresa list — sobre fundo teal claro */
.kpi-empresa-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 2px;
}

.kpi-empresa-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.kpi-empresa-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}

.kpi-empresa-nome {
  color: var(--gpon-muted);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  font-size: .55rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.kpi-empresa-val {
  font-weight: 700;
  font-family: 'IBM Plex Mono', monospace;
  font-size: .65rem;
  flex-shrink: 0;
}

/* ── KPI Reincidência ─────────────────────────────────────── */
.kpi-reinc-body {
  display: flex;
  flex-direction: column;
  gap: 5px;
  justify-content: center;
  flex: 1;
  transition: opacity .25s ease;
}

.kpi-reinc-body.kpi-reinc-updating {
  opacity: .35;
  pointer-events: none;
}

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

.kpi-reinc-gpon {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  color: var(--gpon-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: .02em;
  line-height: 1.2;
}

.kpi-reinc-sp {
  align-self: flex-start;
  font-size: 10px;
}

.kpi-reinc-time {
  font-size: 8px;
  color: var(--gpon-muted);
  opacity: .8;
}

.kpi-reinc-empty {
  font-size: 10px;
  color: var(--gpon-muted);
}

.kpi-empresa-loading {
  color: var(--gpon-muted);
  font-size: .7rem;
}

/* ── TABLE CARD ──────────────────────────────────────────── */
.table-card {
  background: var(--gpon-surface);
  border: 1px solid var(--gpon-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 16px;
}

.table-card-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 12px;
  gap: 10px;
  flex-wrap: wrap;
}

.table-card-header .table-actions {
  margin-left: auto;
}

.table-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--gpon-text);
  display: flex;
  align-items: center;
  gap: 6px;
}

.table-card-title i {
  color: var(--gpon-primary);
}

.title-uf-badge {
  font-size: 11px;
  font-weight: 700;
  font-family: 'IBM Plex Mono', monospace;
  color: var(--gpon-primary);
  background: rgba(124, 58, 237, .1);
  border: 1px solid rgba(124, 58, 237, .22);
  border-radius: 6px;
  padding: 2px 8px;
  letter-spacing: .5px;
  vertical-align: middle;
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── TOGGLE INCLUIR ENCERRADAS ───────────────────────────── */
.enc-toggle-lbl {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--gpon-muted);
  cursor: pointer;
  user-select: none;
  padding: 4px 9px;
  border: 1px solid var(--gpon-border);
  border-radius: 6px;
  background: #fff;
  transition: border-color .15s, color .15s, background .15s;
  white-space: nowrap;
}

.enc-toggle-lbl:hover {
  border-color: var(--gpon-primary);
  color: var(--gpon-primary);
  background: #f5f3ff;
}

.enc-chk {
  accent-color: var(--gpon-primary);
  width: 13px;
  height: 13px;
  cursor: pointer;
  margin: 0;
}

.enc-toggle-lbl:has(.enc-chk:checked) {
  background: #f5f3ff;
  border-color: var(--gpon-primary);
  color: var(--gpon-primary);
}

/* ── DATATABLES OVERRIDES ────────────────────────────────── */
.dataTables_wrapper {
  font-size: 13px;
}

.dataTables_wrapper .dataTables_filter label {
  font-size: 0;
  position: relative;
  display: inline-flex;
  align-items: center;
}

.dataTables_wrapper .dataTables_filter label::before {
  content: '\f52a';
  font-family: 'bootstrap-icons';
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 14px;
  pointer-events: none;
  z-index: 1;
  transition: color .2s;
}

.dataTables_wrapper .dataTables_filter label:focus-within::before {
  color: var(--gpon-primary);
}

.dataTables_wrapper .dataTables_filter input {
  font-size: 13px;
  height: 30px;
  width: 148px;
  border: 1px solid var(--gpon-border);
  border-radius: 10px;
  padding: 0 14px 0 38px;
  background: #fff;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}

.dataTables_wrapper .dataTables_filter input:hover {
  border-color: #a78bfa;
}

.dataTables_wrapper .dataTables_filter input:focus {
  border-color: var(--gpon-primary);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, .15);
}

.dataTables_wrapper .dataTables_length select {
  border: 1px solid var(--gpon-border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 13px;
}

.dataTables_wrapper .dataTables_info {
  font-size: 12px;
  color: var(--gpon-muted);
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  border-radius: var(--radius-sm) !important;
  font-size: 12px !important;
  padding: 3px 8px !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: var(--gpon-primary) !important;
  border-color: var(--gpon-primary-dark) !important;
  color: #fff !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover:not(.current) {
  background: #ede9fe !important;
  border-color: var(--gpon-border) !important;
  color: var(--gpon-primary) !important;
}

table.dataTable thead th {
  background: #f5f3ff;
  border-bottom: 2px solid var(--gpon-border) !important;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--gpon-muted);
  padding: 6px 10px !important;
  white-space: nowrap;
}

table.dataTable thead th.sorting::after,
table.dataTable thead th.sorting_asc::after,
table.dataTable thead th.sorting_desc::after {
  color: var(--gpon-primary);
}

table.dataTable tbody tr {
  transition: background .1s;
}

table.dataTable tbody tr:hover td {
  background: #f5f3ff !important;
}

table.dataTable tbody td {
  padding: 5px 10px !important;
  border-bottom: 1px solid #f0ecff !important;
  vertical-align: middle;
  font-size: 12px;
  font-weight: 500;
}

table.dataTable tbody tr.odd td {
  background: #fafaf8;
}

table.dataTable tbody tr.even td {
  background: #ffffff;
}

/* ── FixedColumns — integração visual ────────────────────── */
/* Remove fundo e sombra padrão do plugin */
.dtfc-fixed-left,
.dtfc-fixed-right {
  background: transparent !important;
  box-shadow: none !important;
}

/* thead fixo: mesma cor do thead geral */
table.dataTable thead th.dtfc-fixed-left,
table.dataTable thead th.dtfc-fixed-right {
  background: #f5f3ff !important;
  box-shadow: none !important;
}

/* tbody fixo: herda cor alternada da linha (odd/even) */
table.dataTable tbody tr.odd td.dtfc-fixed-left,
table.dataTable tbody tr.odd td.dtfc-fixed-right {
  background: #fafaf8 !important;
}

table.dataTable tbody tr.even td.dtfc-fixed-left,
table.dataTable tbody tr.even td.dtfc-fixed-right {
  background: #ffffff !important;
}

/* hover nas colunas fixas acompanha o hover da linha */
table.dataTable tbody tr:hover td.dtfc-fixed-left,
table.dataTable tbody tr:hover td.dtfc-fixed-right {
  background: #f5f3ff !important;
}

/* Separador sutil no lugar da sombra pesada */
td.dtfc-fixed-left:last-of-type,
th.dtfc-fixed-left:last-of-type {
  border-right: 1px solid rgba(124, 58, 237, .10) !important;
}

td.dtfc-fixed-right:first-of-type,
th.dtfc-fixed-right:first-of-type {
  border-left: 1px solid rgba(124, 58, 237, .10) !important;
}

/* Row highlight by status */
tr.row-encerrada td {
  opacity: .75;
}

/* ── BADGES ──────────────────────────────────────────────── */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  white-space: nowrap;
}

.badge-aberta {
  background: #dbeafe;
  color: #1d4ed8;
}

.badge-encerrada {
  background: #f1f5f9;
  color: #475569;
}

.badge-andamento {
  background: #fef3c7;
  color: #92400e;
}

.badge-dentro-prazo {
  background: #dcfce7;
  color: #15803d;
}

.badge-proximo-prazo {
  background: #fef3c7;
  color: #b45309;
}

.badge-fora-prazo {
  background: #fee2e2;
  color: #b91c1c;
}

.badge-sim {
  background: #fee2e2;
  color: #b91c1c;
}

.badge-nao {
  background: #f1f5f9;
  color: #6b7280;
}

.badge-reinc {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  font-family: 'IBM Plex Mono', monospace;
  cursor: default;
  vertical-align: middle;
}

.badge-reinc.reinc-cinza {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #e2e8f0;
}

.badge-reinc.reinc-verde {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}

.badge-reinc.reinc-amarelo {
  background: #fef9c3;
  color: #854d0e;
  border: 1px solid #fde047;
}

.badge-reinc.reinc-laranja {
  background: #ffedd5;
  color: #9a3412;
  border: 1px solid #fdba74;
}

.badge-reinc.reinc-vermelho {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.badge-admin {
  background: #fef3c7;
  color: #92400e;
}

.badge-user {
  background: #dbeafe;
  color: #1e40af;
}

.badge-reinc-clickable {
  cursor: pointer;
}

.badge-reinc-clickable:hover {
  filter: brightness(.92);
  box-shadow: 0 0 0 2px rgba(124, 58, 237, .3);
}

/* ── Modal Histórico (compartilhado: dashboard + analise) ──── */
.hist-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 15, 30, .52);
  backdrop-filter: blur(3px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.hist-modal-box {
  background: #fff;
  border-radius: 14px;
  width: 100%;
  max-width: 1140px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .22);
}

.hist-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 18px 22px 14px;
  border-bottom: 1px solid #ede9fe;
  background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
  border-radius: 14px 14px 0 0;
}

.hist-modal-title {
  font-size: 15px;
  font-weight: 800;
  color: #5b21b6;
  letter-spacing: -.01em;
}

.hist-modal-sub {
  font-size: 11px;
  color: #7c3aed;
  margin-top: 3px;
  font-family: 'IBM Plex Mono', monospace;
}

.hist-modal-close {
  background: none;
  border: none;
  font-size: 22px;
  color: #94a3b8;
  cursor: pointer;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 6px;
  transition: background .15s, color .15s;
  flex-shrink: 0;
  margin-left: 12px;
}

.hist-modal-close:hover {
  background: #fee2e2;
  color: #dc2626;
}

.hist-modal-body {
  padding: 16px 22px 22px;
  overflow-y: auto;
  flex: 1;
}

.hist-loading {
  text-align: center;
  padding: 32px;
  color: #94a3b8;
  font-size: 13px;
}

.hist-loading i {
  font-size: 28px;
  display: block;
  margin-bottom: 8px;
}

.hist-period-filter {
  display: flex;
  align-items: center;
  gap: 5px;
  padding-bottom: 10px;
  margin-bottom: 8px;
  border-bottom: 1px solid #ede9fe;
}

.hist-period-label {
  font-size: 11px;
  color: #7c3aed;
  font-weight: 600;
  margin-right: 2px;
}

.hist-period-btn {
  border: 1px solid #ddd6fe;
  background: #fff;
  color: #7c3aed;
  border-radius: 16px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}

.hist-period-btn:hover {
  border-color: #7c3aed;
  background: #f5f3ff;
}

.hist-period-btn.active {
  background: var(--gpon-primary);
  color: #fff;
  border-color: var(--gpon-primary);
}

#tbl-historico {
  font-size: 11px;
}

#tbl-historico thead th {
  background: #f8f7ff;
  color: #5b21b6;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

#tbl-historico tbody td {
  font-size: 11px;
  font-weight: 500;
  vertical-align: middle;
}

#tbl-historico_wrapper .dataTables_filter input {
  width: 180px;
}

.mono-oc {
  color: var(--gpon-primary);
}

.hist-trunc {
  max-width: 160px;
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hist-tbl-clickable {
  cursor: pointer;
}

.hist-tbl-clickable:hover td {
  background: #f5f3ff !important;
}

/* ── Previsão de Finalização ─────────────────────────────── */
.previsao-block {
  background: #faf8ff;
  border: 1px solid rgba(124, 58, 237, .14);
  border-radius: 8px;
  padding: 10px 12px;
}

.previsao-block-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--gpon-primary);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 8px;
}

.previsao-block-header i {
  font-size: 13px;
}

.previsao-input-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.previsao-input {
  flex: 1;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
}

.previsao-btn-clear,
.previsao-btn-save {
  font-size: 11px;
  white-space: nowrap;
}

.previsao-sla-info {
  margin-top: 4px;
  font-size: 11px;
  color: var(--gpon-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Marcação de Revisão */
.mh-revisao-row {
  margin-top: 4px;
}

.mh-revisao-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
}

.mh-revisao-btn.mh-revisao-btn-marcado {
  background: #fffbeb;
  border-color: #fbbf24;
  color: #92400e;
}

.mh-revisao-btn.mh-revisao-btn-marcado:hover {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #92400e;
}

.mh-revisao-btn:disabled {
  opacity: .6;
  cursor: not-allowed;
}

.mh-revisao-btn:focus-visible {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
}

/* Ação discreta "+ Adicionar nota de revisão" */
.mh-revisao-note-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  padding: 2px 0;
  border: none;
  background: none;
  font-size: 10px;
  font-weight: 600;
  color: var(--gpon-primary);
  cursor: pointer;
  transition: color .15s;
}

.mh-revisao-note-toggle:hover {
  color: #5b21b6;
  text-decoration: underline;
}

.mh-revisao-note-toggle:focus-visible {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
}

/* Formulários compactos de Nota / Conclusão de revisão — recolhidos por
   padrão (não reservam espaço); expandem com transição discreta, mesmo
   padrão de .sf-card-body/.collapsed já usado na sidebar de filtros. */
.mh-revisao-form {
  max-height: 0;
  opacity: 0;
  margin-top: 0;
  overflow: hidden;
  transition: max-height .22s ease, opacity .18s ease, margin-top .22s ease;
}

.mh-revisao-form.open {
  max-height: 220px;
  opacity: 1;
  margin-top: 8px;
}

.mh-revisao-form-title {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #92400e;
  margin-bottom: 4px;
}

.mh-revisao-textarea {
  width: 100%;
  resize: none;
  font-size: 11px;
}

.mh-revisao-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 6px;
}

.previsao-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.previsao-ok {
  background: #dcfce7;
  color: #15803d;
}

.previsao-atencao {
  background: #fef9c3;
  color: #92400e;
}

.previsao-critica {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
  animation: previsao-pulse 2s ease-in-out infinite;
}

@keyframes previsao-pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: .7;
  }
}

.reinc-alerta {
  display: inline-block;
  margin-left: 3px;
  font-size: 11px;
  line-height: 1;
  cursor: default;
  vertical-align: middle;
}

.reinc-alerta-critica {
  filter: drop-shadow(0 0 3px rgba(220, 38, 38, .5));
}

.reinc-alerta-recente {
  color: #f59e0b;
  opacity: 1;
  text-shadow: 0 0 7px rgba(245, 158, 11, .4);
}

/* ── PREVISÃO ICON ───────────────────────────────────────── */
.previsao-icon {
  font-size: 11px;
  color: var(--gpon-primary);
  vertical-align: middle;
  cursor: default;
  opacity: .82;
  transition: opacity .15s, color .15s;
}

.previsao-icon:hover {
  opacity: 1;
  color: #6d28d9;
}

/* ── AGING DISPLAY ───────────────────────────────────────── */
.aging-value {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--gpon-text);
}

.aging-value.danger {
  color: var(--gpon-danger);
}

.aging-value.warning {
  color: var(--gpon-warning);
}

.aging-value.ok {
  color: var(--gpon-success);
}


/* ── ACTION BUTTONS ──────────────────────────────────────── */
.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--gpon-border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--gpon-muted);
  cursor: pointer;
  transition: all .15s;
  font-size: 13px;
  text-decoration: none;
}

.action-btn:hover {
  border-color: var(--gpon-primary);
  color: var(--gpon-primary);
  background: #f5f3ff;
}

.action-btn.view:hover {
  border-color: #0284c7;
  color: #0284c7;
  background: #e0f2fe;
}

.action-btn.edit:hover {
  border-color: #d97706;
  color: #d97706;
  background: #fef3c7;
}

.action-btn.del:hover {
  border-color: var(--gpon-danger);
  color: var(--gpon-danger);
  background: #fee2e2;
}

.action-btn.history:hover {
  border-color: #7c3aed;
  color: #7c3aed;
  background: #f5f3ff;
}

.action-btn.history.has-hist {
  color: #15803d;
  border-color: #16a34a;
  background: #dcfce7;
  transition: color .2s, border-color .2s, background .2s;
}

.action-btn.history.has-hist:hover {
  color: #14532d;
  border-color: #15803d;
  background: #bbf7d0;
}

.action-btn.sigma-history:hover {
  border-color: #0e7490;
  color: #0e7490;
  background: #ecfeff;
}

/* Mantém a aparência de :hover enquanto o popup do próprio botão está
   aberto (classe "active" adicionada/removida em JS — gpon.js e
   eficiencia.js). Compartilhada entre Dashboard e Eficiência. */
.action-btn.sigma-history.active {
  border-color: #0e7490;
  color: #0e7490;
  background: #ecfeff;
}

.action-group {
  display: flex;
  gap: 4px;
  align-items: center;
}

#gpon-table tbody tr {
  cursor: pointer;
}

#gpon-table tbody tr:hover td {
  background: #f5f3ff !important;
}

/* ── Fixed columns & scroll ──────────────────────────────── */
#gpon-table th,
#gpon-table td {
  white-space: nowrap;
}

.dataTables_scrollBody,
.dataTables_scrollHead {
  border: none !important;
  box-shadow: none !important;
  background: transparent !important;
  margin: 0 !important;
  padding: 0 !important;
}

.dataTables_scrollBody {
  scroll-behavior: smooth;
  overflow-x: auto !important;
  overflow-y: auto;
}

.dataTables_scrollFoot {
  display: none !important;
}

.dataTables_scrollBody.no-hscroll {
  overflow-x: hidden !important;
}

.dataTables_scrollHeadInner,
.dataTables_scrollHeadInner table {
  margin-bottom: 0 !important;
  border-bottom: none !important;
}

/* ── MODALS ──────────────────────────────────────────────── */
.modal-header {
  background: linear-gradient(135deg, #3b0764, #7c3aed);
  color: #fff;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.modal-header .modal-title {
  font-weight: 700;
  font-size: 15px;
}

.modal-header .btn-close {
  filter: invert(1) brightness(2);
  opacity: .8;
}

.modal-header .btn-close:hover {
  opacity: 1;
}

.modal-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--gpon-muted);
  margin-bottom: 3px;
}

.modal-value {
  font-size: 13px;
  color: var(--gpon-text);
  font-weight: 500;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.detail-grid.three {
  grid-template-columns: 1fr 1fr 1fr;
}

.detail-grid.four {
  grid-template-columns: 1fr 1fr 1fr 1fr;
}

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

/* ── UPLOAD MODAL ────────────────────────────────────────── */
.upload-area {
  border: 2px dashed var(--gpon-border);
  border-radius: var(--radius-md);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  background: #fafaf8;
}

.upload-area:hover,
.upload-area.dragover {
  border-color: var(--gpon-primary);
  background: #f5f3ff;
}

.upload-area i {
  font-size: 40px;
  color: var(--gpon-primary);
  opacity: .6;
  display: block;
  margin-bottom: 10px;
}

.upload-area .upload-label {
  font-size: 14px;
  color: var(--gpon-text);
  font-weight: 500;
}

.upload-area .upload-sub {
  font-size: 12px;
  color: var(--gpon-muted);
  margin-top: 4px;
}

.upload-progress {
  display: none;
  margin-top: 16px;
}

.progress-bar-gpon {
  height: 6px;
  border-radius: 3px;
  background: var(--gpon-primary);
  transition: width .3s;
}

/* ── IMPORT RESULT ───────────────────────────────────────── */
.import-result {
  display: none;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-top: 12px;
  font-size: 13px;
}

.import-result.success {
  background: #dcfce7;
  border: 1px solid #86efac;
  color: #15803d;
}

.import-result.error {
  background: #fee2e2;
  border: 1px solid #fca5a5;
  color: #b91c1c;
}

.import-result.info {
  background: #eff6ff;
  border: 1px solid #93c5fd;
  color: #1d4ed8;
}

/* ── REINC. PERIOD TOOLBAR ──────────────────────────────── */
.reinc-period-toolbar {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.reinc-period-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--gpon-primary);
  margin-right: 3px;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.reinc-period-btn {
  border: 1px solid #ddd6fe;
  background: #fff;
  color: #7c3aed;
  border-radius: 20px;
  padding: 3px 12px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
  line-height: 1.4;
}

.reinc-period-btn:hover {
  border-color: var(--gpon-primary);
  background: #f5f3ff;
}

.reinc-period-btn.active {
  background: var(--gpon-primary);
  color: #fff;
  border-color: var(--gpon-primary);
  box-shadow: 0 2px 8px rgba(109, 40, 217, .25);
}

.reinc-period-spin {
  display: none;
  font-size: 13px;
  color: var(--gpon-primary);
  margin-left: 4px;
  animation: reinc-spin .7s linear infinite;
}

.reinc-period-toolbar.loading .reinc-period-spin {
  display: inline-block;
}

.reinc-period-toolbar.loading .reinc-period-btn {
  opacity: .55;
  pointer-events: none;
}

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

/* ── MÉTRICAS OPERACIONAIS INLINE (cabeçalho tabela) ────── */
.ops-metric-inline {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: wrap;
}

.om-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 6px;
  background: var(--gpon-surface);
  border: 1px solid var(--gpon-border);
  font-size: 11px;
  cursor: default;
  white-space: nowrap;
  line-height: 1.4;
}

.om-chip i {
  color: var(--gpon-primary);
  font-size: 11px;
  opacity: .8;
}

.om-chip strong {
  font-size: 13px;
  font-weight: 800;
  font-family: 'IBM Plex Mono', monospace;
  color: var(--gpon-text);
}

.om-chip span {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--gpon-muted);
}

@media (max-width: 576px) {
  .ops-metric-inline {
    display: none;
  }
}

/* ── UPLOAD OVERLAY ─────────────────────────────────────── */
#upload-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(10, 10, 20, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  transition: background .25s;
}

#upload-overlay.active {
  display: flex;
}

.upload-loading-box {
  background: linear-gradient(180deg, rgba(38, 32, 68, 0.97) 0%, rgba(26, 22, 50, 0.97) 100%);
  border: 1px solid rgba(167, 139, 250, .32);
  border-radius: 20px;
  padding: 38px 52px 34px;
  text-align: center;
  box-shadow:
    0 0 0 1px rgba(139, 92, 246, .08),
    0 0 48px rgba(139, 92, 246, .18),
    0 24px 64px rgba(0, 0, 0, .45);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  min-width: 320px;
  max-width: 420px;
  width: 90%;
  animation: ov-fadein .28s cubic-bezier(.22, .68, 0, 1.2);
}

@keyframes ov-fadein {
  from {
    opacity: 0;
    transform: translateY(18px) scale(.95);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

/* Spinner SVG */
.upload-spinner {
  width: 68px;
  height: 68px;
  margin: 0 auto 24px;
}

.upload-spinner-svg {
  width: 68px;
  height: 68px;
  animation: sp-rotate 1.3s linear infinite;
  filter: drop-shadow(0 0 10px rgba(139, 92, 246, .45));
}

.upload-spinner-track {
  stroke: rgba(167, 139, 250, .15);
}

.upload-spinner-arc {
  stroke: #a78bfa;
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 70;
  animation: sp-dash 1.3s ease-in-out infinite;
}

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

@keyframes sp-dash {
  0% {
    stroke-dashoffset: 100;
  }

  50% {
    stroke-dashoffset: 20;
  }

  100% {
    stroke-dashoffset: 100;
  }
}

/* Title / sub */
.upload-loading-box .loading-title {
  font-size: 17px;
  font-weight: 700;
  color: #f1f0ff;
  margin-bottom: 6px;
  letter-spacing: .3px;
}

.upload-loading-box .loading-sub {
  font-size: 13px;
  color: rgba(209, 196, 255, .72);
  margin-bottom: 28px;
  min-height: 20px;
  transition: color .3s;
}

/* Steps */
.overlay-steps {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 26px;
}

.overlay-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  opacity: .28;
  transition: opacity .35s ease, transform .25s ease;
}

.overlay-step.active {
  opacity: 1;
  transform: translateY(-2px);
}

.overlay-step.done {
  opacity: .75;
}

.overlay-step .step-icon {
  font-size: 22px;
  color: rgba(209, 196, 255, .35);
  transition: color .3s, filter .3s;
}

.overlay-step.active .step-icon {
  color: #c4b5fd;
  filter: drop-shadow(0 0 7px rgba(196, 181, 253, .8));
}

.overlay-step.done .step-icon {
  color: #4ade80;
  filter: drop-shadow(0 0 5px rgba(74, 222, 128, .45));
}

.overlay-step .step-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: rgba(209, 196, 255, .38);
  font-family: 'IBM Plex Mono', monospace;
  transition: color .3s;
}

.overlay-step.active .step-label {
  color: rgba(244, 240, 255, .92);
}

.overlay-step.done .step-label {
  color: rgba(74, 222, 128, .85);
}

/* Separator line between steps */
.overlay-steps::before {
  display: none;
}

/* Progress bar */
.overlay-bar-wrap {
  height: 8px;
  background: rgba(255, 255, 255, .08);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 10px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .25);
}

.overlay-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #6d28d9 0%, #8b5cf6 50%, #c4b5fd 100%);
  border-radius: 999px;
  transition: width .5s cubic-bezier(.4, 0, .2, 1);
  box-shadow: 0 0 14px rgba(139, 92, 246, .7), 0 0 4px rgba(196, 181, 253, .4);
  position: relative;
}

.overlay-bar::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 24px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .35));
  border-radius: 0 999px 999px 0;
  animation: bar-shine 1.6s ease-in-out infinite;
}

@keyframes bar-shine {

  0%,
  100% {
    opacity: 0;
  }

  50% {
    opacity: 1;
  }
}

.overlay-pct {
  font-size: 11px;
  font-family: 'IBM Plex Mono', monospace;
  color: rgba(209, 196, 255, .6);
  text-align: right;
  transition: color .3s;
}

/* ── MODAL HISTÓRICO NOC (mh-*) ─────────────────────────── */
.mh-modal {
  border-radius: 14px;
  overflow: hidden;
  border: none;
  display: flex;
  flex-direction: column;
  max-height: 85vh;
}

#modalHistory .modal-dialog {
  max-width: 800px;
  width: calc(100vw - 48px);
}

.mh-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  gap: 10px;
  flex-shrink: 0;
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 55%, #4c1d95 100%);
}

.mh-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.mh-header-icon {
  width: 30px;
  height: 30px;
  background: rgba(255, 255, 255, .12);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #c4b5fd;
  font-size: 14px;
  flex-shrink: 0;
}

.mh-header-title {
  font-size: 13px;
  font-weight: 700;
  color: #f1f0ff;
  font-family: 'IBM Plex Mono', monospace;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.mh-header-sub {
  font-size: 10px;
  color: rgba(196, 181, 253, .7);
  margin-top: 1px;
  letter-spacing: .03em;
}

.mh-sep {
  color: rgba(196, 181, 253, .4);
  font-weight: 400;
}

.mh-close-btn {
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .15);
  color: #c4b5fd;
  border-radius: 7px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 11px;
  transition: background .15s, color .15s, border-color .15s;
}

.mh-close-btn:hover {
  background: rgba(220, 38, 38, .3);
  color: #fca5a5;
  border-color: #fca5a5;
}

/* Corpo: altura por conteúdo (não mais um valor fixo em pixels). Cada
   coluna cresce de acordo com o próprio conteúdo — align-items:flex-start
   evita que o Histórico vazio seja esticado até a altura do card de
   Previsão (essa era a causa do espaço em branco). */
.mh-body {
  display: flex;
  align-items: flex-start;
  flex: 0 1 auto;
  min-height: 0;
}

/* Histórico Operacional: única área com rolagem própria no desktop —
   cresce com o conteúdo até o limite abaixo e só a partir daí rola. */
.mh-left {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  border-right: 1px solid var(--gpon-border);
  max-height: 260px;
  overflow-x: hidden;
  overflow-y: auto;
}

/* Previsão de Finalização: sempre altura automática e totalmente visível —
   nunca corta conteúdo, nunca cria rolagem própria. */
.mh-right {
  width: 320px;
  flex-shrink: 0;
  padding: 6px;
  background: #f8f7ff;
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: auto;
  max-height: none;
  overflow: visible;
}

.mh-section-hdr {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--gpon-muted);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--gpon-border);
}

.mh-card-hdr {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--gpon-primary);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

/* Card Previsão */
.mh-prev-card {
  background: #fff;
  border: 1px solid #ddd6fe;
  border-radius: 10px;
  padding: 10px;
  box-shadow: 0 2px 8px rgba(124, 58, 237, .07);
  width: 100%;
  height: auto;
  max-height: none;
  overflow: visible;
  box-sizing: border-box;
}

.mh-prev-date-display {
  font-size: 22px;
  font-weight: 800;
  font-family: 'IBM Plex Mono', monospace;
  color: var(--gpon-text);
  margin-bottom: 4px;
  letter-spacing: -.02em;
  line-height: 1.2;
  transition: color .25s;
}

.mh-prev-date-display.mh-prev-ok {
  color: #15803d;
}

.mh-prev-date-display.mh-prev-atencao {
  color: #92400e;
}

.mh-prev-date-display.mh-prev-critica {
  color: #991b1b;
}

.mh-prev-status-wrap {
  min-height: 16px;
  margin-bottom: 2px;
}

/* Sem badge de status (previsão sem status calculado): não reserva espaço */
.mh-prev-status-wrap:empty {
  min-height: 0;
  margin-bottom: 0;
}

.mh-prev-fields {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid #ede9fe;
}

.mh-prev-btns {
  display: flex;
  gap: 6px;
  margin-top: 4px;
  justify-content: flex-end;
}

/* Rodapé Novo Comentário (largura total, abaixo das duas colunas) */
.mh-comment-card {
  background: #fff;
  border-top: 1px solid var(--gpon-border);
  padding: 6px 14px 8px;
  flex: 0 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.mh-comment-area {
  width: 100%;
  resize: vertical;
  font-size: 13px;
  font-family: inherit;
  line-height: 1.5;
}

#new-comment {
  min-height: 60px;
  max-height: 60px;
  resize: vertical;
}

.mh-comment-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 4px;
}

.mh-timeline-wrap {
  padding-bottom: 8px;
}

/* .mh-body-marked / .mh-body-expanded continuam sendo alternadas pelo JS
   conforme o estado da Revisão, mas não precisam mais de regra de altura
   própria aqui: .mh-right (acima) já é sempre altura automática e
   totalmente visível, em qualquer estado. */

/* Celular: uma única rolagem principal no modal inteiro (cabeçalho,
   Histórico, Previsão e Nova Tratativa empilhados no mesmo fluxo) — nenhuma
   dessas áreas tem rolagem própria, evitando rolagens concorrentes. */
@media (max-width: 768px) {
  #modalHistory .modal-dialog {
    width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
    margin: 8px auto;
  }

  .mh-modal {
    max-height: 100vh;
    /* fallback para navegadores sem suporte a dvh */
    max-height: calc(100dvh - 16px);
    overflow-y: auto;
    overflow-x: hidden;
  }

  .mh-body {
    flex-direction: column;
    flex: 0 0 auto;
    max-height: none;
    overflow: visible;
  }

  .mh-right {
    width: 100%;
    border-top: 1px solid var(--gpon-border);
    max-height: none;
    overflow: visible;
  }

  .mh-left {
    border-right: none;
    max-height: none;
    overflow: visible;
  }
}

/* ── HISTORY TIMELINE ────────────────────────────────────── */
.timeline {
  list-style: none;
  padding: 0;
  margin: 0;
  position: relative;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 14px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--gpon-border);
}

.timeline-item {
  display: flex;
  gap: 14px;
  margin-bottom: 16px;
  position: relative;
}

.timeline-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--gpon-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  font-family: 'IBM Plex Mono', monospace;
  flex-shrink: 0;
  z-index: 1;
  box-shadow: 0 0 0 3px #fff, 0 0 0 4px rgba(124, 58, 237, .18);
}

.timeline-dot.comentario {
  background: #7c3aed;
  box-shadow: 0 0 0 3px #fff, 0 0 0 4px rgba(124, 58, 237, .22);
}

.timeline-dot.edicao {
  background: #d97706;
  box-shadow: 0 0 0 3px #fff, 0 0 0 4px rgba(217, 119, 6, .22);
}

.timeline-dot.importacao {
  background: #0284c7;
  box-shadow: 0 0 0 3px #fff, 0 0 0 4px rgba(2, 132, 199, .22);
}

.timeline-dot.exclusao {
  background: #dc2626;
  box-shadow: 0 0 0 3px #fff, 0 0 0 4px rgba(220, 38, 38, .22);
}

.timeline-body {
  flex: 1;
  padding: 10px 12px;
  background: #f8f7ff;
  border-radius: var(--radius-sm);
  border: 1px solid var(--gpon-border);
  border-left: 3px solid #7c3aed;
  position: relative;
}

.timeline-body.tl-edicao {
  background: #fffdf4;
  border-left-color: #d97706;
}

.timeline-body.tl-exclusao {
  background: #fff5f5;
  border-left-color: #dc2626;
}

.timeline-meta {
  font-size: 11px;
  color: var(--gpon-muted);
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-right: 52px;
  gap: 6px;
}

.timeline-text {
  font-size: 13px;
  color: var(--gpon-text);
  line-height: 1.5;
}

/* ── History item actions (edit / delete) */
.hist-item-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity .15s;
}

.timeline-body:hover .hist-item-actions {
  opacity: 1;
}

.hist-btn {
  width: 26px;
  height: 26px;
  border: 1px solid var(--gpon-border);
  border-radius: 6px;
  background: var(--gpon-surface);
  color: var(--gpon-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  padding: 0;
  line-height: 1;
}

.hist-btn:hover {
  background: #f8fafc;
}

.hist-btn.edit:hover {
  color: var(--gpon-primary);
  border-color: #c4b5fd;
}

.hist-btn.delete:hover {
  color: #dc2626;
  border-color: #fca5a5;
}

.hist-edit-area {
  width: 100%;
  border: 1.5px solid var(--gpon-primary);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 12px;
  font-family: inherit;
  resize: vertical;
  min-height: 56px;
  outline: none;
  box-sizing: border-box;
  background: #fff;
}

.hist-edit-footer {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 6px;
}

/* ── ADMIN PANEL ─────────────────────────────────────────── */
.admin-card {
  background: var(--gpon-surface);
  border: 1px solid var(--gpon-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  margin-bottom: 20px;
}

.admin-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.admin-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--gpon-text);
}

/* ── LOGIN PAGE ──────────────────────────────────────────── */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e1b4b 0%, #4c1d95 50%, #7c3aed 100%);
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
  overflow: hidden;
}

.login-header {
  background: linear-gradient(135deg, #3b0764, #7c3aed);
  padding: 28px 24px 24px;
  text-align: center;
}

.login-logo {
  font-size: 40px;
  margin-bottom: 8px;
}

.login-title {
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  margin: 0;
}

.login-sub {
  font-size: 12px;
  color: #d8b4fe;
  margin-top: 4px;
}

.login-body {
  padding: 28px 24px;
}

.login-group {
  margin-bottom: 16px;
}

.login-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--gpon-muted);
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-bottom: 5px;
}

.login-input {
  width: 100%;
  padding: 10px 14px 10px 36px;
  border: 1px solid var(--gpon-border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  position: relative;
}

.login-input:focus {
  border-color: var(--gpon-primary);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, .15);
}

.login-input-wrap {
  position: relative;
}

.login-input-wrap i {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gpon-muted);
  font-size: 15px;
}

.login-btn {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #7c3aed, #5b21b6);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
  margin-top: 4px;
}

.login-btn:hover {
  background: linear-gradient(135deg, #6d28d9, #4c1d95);
  transform: translateY(-1px);
}

.login-alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
}

.login-alert.error {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
}

.login-alert.success {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
}

/* ── EMPTY STATE ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gpon-muted);
}

.empty-state i {
  font-size: 48px;
  opacity: .3;
  display: block;
  margin-bottom: 12px;
}

.empty-state p {
  font-size: 14px;
  margin: 0;
}

/* ── HAMBURGER SIDEBAR TOGGLE ────────────────────────────── */
.sidebar-toggle {
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .2);
  color: #fff;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  transition: background .15s;
  flex-shrink: 0;
}

.sidebar-toggle:hover {
  background: rgba(255, 255, 255, .2);
}

/* ── FLASH MESSAGE ───────────────────────────────────────── */
.flash-bar {
  position: fixed;
  top: calc(var(--gpon-header-h) + 10px);
  right: 16px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}

.flash-msg {
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  pointer-events: auto;
  animation: slideIn .25s ease;
  max-width: 340px;
}

.flash-msg.success {
  background: #dcfce7;
  color: #15803d;
  border-left: 4px solid #16a34a;
}

.flash-msg.error {
  background: #fee2e2;
  color: #b91c1c;
  border-left: 4px solid #dc2626;
}

.flash-msg.info {
  background: #dbeafe;
  color: #1d4ed8;
  border-left: 4px solid #0284c7;
}

/* ── Toast estruturado (importação, operações complexas) ──── */
.flash-toast {
  width: 288px;
  background: #fff;
  border: 1px solid #e8e3ff;
  border-left: 4px solid #16a34a;
  border-radius: 10px;
  padding: 12px 14px 10px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .12), 0 1px 4px rgba(0, 0, 0, .06);
  pointer-events: auto;
  animation: slideIn .28s cubic-bezier(.22, .68, 0, 1.2);
  transition: opacity .3s ease;
}

.flash-toast.error {
  border-left-color: #dc2626;
}

.flash-toast.info {
  border-left-color: #0284c7;
}

.flash-toast-header {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 7px;
}

.flash-toast-icon {
  font-size: 14px;
  flex-shrink: 0;
}

.flash-toast.success .flash-toast-icon {
  color: #16a34a;
}

.flash-toast.error .flash-toast-icon {
  color: #dc2626;
}

.flash-toast.info .flash-toast-icon {
  color: #0284c7;
}

.flash-toast-title {
  font-size: 12px;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.2;
}

.flash-toast-body {
  font-size: 11px;
  font-family: 'IBM Plex Mono', monospace;
  color: #64748b;
  line-height: 1.7;
  padding-left: 21px;
}

@keyframes slideIn {
  from {
    transform: translateX(60px);
    opacity: 0;
  }

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

/* ── MT FIELD ────────────────────────────────────────────── */
.mt-badge {
  display: inline-block;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  color: var(--gpon-muted);
  vertical-align: middle;
  cursor: help;
}

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .gpon-sidebar {
    position: fixed;
    top: var(--gpon-header-h);
    left: 0;
    z-index: 900;
    height: calc(100vh - var(--gpon-header-h));
    width: var(--gpon-sidebar-w);
    box-shadow: 4px 0 16px rgba(0, 0, 0, .15);
  }

  .gpon-sidebar.collapsed {
    width: 0;
    box-shadow: none;
  }

  .gpon-main {
    padding: 12px;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .tbtn span {
    display: none;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .detail-grid.three {
    grid-template-columns: 1fr 1fr;
  }

  .detail-grid.four {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 480px) {
  .kpi-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* ── SCROLLBAR ───────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #c4b5fd;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--gpon-primary);
}

/* ── UTILITY ─────────────────────────────────────────────── */
.mono {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
}

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

.fw-700 {
  font-weight: 700;
}

.gap-4 {
  gap: 4px;
}

.d-flex {
  display: flex;
}

.align-center {
  align-items: center;
}

@keyframes ua-pulse {
  0% {
    background: rgba(56, 189, 248, .25);
    border-color: rgba(56, 189, 248, .6);
  }

  100% {
    background: rgba(255, 255, 255, .06);
    border-color: rgba(255, 255, 255, .1);
  }
}

/* ── Popup Resumo Empresas ─────────────────────────────────── */
#emp-popup-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1059;
  background: rgba(0, 0, 0, .22);
}

.emp-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1060;
  background: var(--gpon-surface);
  border: 1px solid var(--gpon-border);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, .18);
  width: min(580px, 94vw);
  max-height: 72vh;
  display: flex;
  flex-direction: column;
  font-size: 13px;
}

.emp-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--gpon-border);
  gap: 8px;
  flex-shrink: 0;
  background: linear-gradient(135deg, #f0fdfa 0%, #e0f2fe 100%);
  border-radius: 10px 10px 0 0;
}

.emp-popup-title {
  font-weight: 700;
  font-size: 12px;
  color: var(--gpon-text);
  letter-spacing: .06em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 7px;
}

.emp-popup-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.emp-popup-btn {
  background: var(--gpon-surface);
  border: 1px solid var(--gpon-border);
  border-radius: 5px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--gpon-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: background .15s, color .15s, border-color .15s;
  font-family: inherit;
}

.emp-popup-btn:hover {
  background: var(--gpon-bg);
  color: var(--gpon-text);
}

.emp-popup-btn.copied {
  color: #16a34a;
  border-color: #86efac;
  background: #f0fdf4;
}

.emp-popup-close-btn {
  padding: 4px 8px;
}

.emp-popup-body {
  overflow-y: auto;
  padding: 16px;
  flex: 1;
  min-height: 0;
}

.emp-popup-group {
  margin-bottom: 20px;
}

.emp-popup-group:last-child {
  margin-bottom: 0;
}

.emp-popup-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--gpon-border);
}

.emp-popup-group-name {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  color: #0e7490;
  text-transform: uppercase;
}

.emp-popup-group-count {
  font-size: 11px;
  font-weight: 700;
  color: var(--gpon-muted);
}

.emp-popup-oc-row {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--gpon-text);
  line-height: 1.9;
  padding: 0 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.emp-popup-em-fila {
  color: #b45309;
  font-weight: 600;
}

.emp-popup-empty {
  color: var(--gpon-muted);
  font-size: 12px;
  text-align: center;
  padding: 24px;
}

/* KPI Empresas — cursor clicável */
.kpi-card[data-type="empresas"] {
  cursor: pointer;
}

.kpi-card[data-type="empresas"]:hover {
  border-color: #14b8a6;
  box-shadow: 0 3px 8px rgba(20, 184, 166, .15);
}

/* KPI Abertas — cursor clicável + foco visível (teclado) */
.kpi-card[data-type="abertas"] {
  cursor: pointer;
}

.kpi-card[data-type="abertas"]:hover {
  border-color: #7c3aed;
  box-shadow: 0 3px 8px rgba(124, 58, 237, .15);
}

.kpi-card[data-type="abertas"]:focus-visible {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
}

/* ── Popup Resumo Ocorrências Abertas (KPI "Abertas") ──────── */
.abertas-popup-count {
  padding: 8px 16px 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--gpon-muted);
  flex-shrink: 0;
}

/* Filtro rápido Todas/Massivas/Demais (seção 2) — mesmo espírito visual
   dos filtros rápidos por pílula já usados no projeto (ex.: .efic-qf-btn),
   escopado só a este popup. Client-side puro, sem afetar os filtros
   globais do Dashboard. */
.abertas-popup-filtros {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 16px 0;
  flex-shrink: 0;
}

.abertas-popup-filtro-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--gpon-border);
  background: var(--gpon-bg);
  color: var(--gpon-muted);
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  line-height: 1.4;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}

.abertas-popup-filtro-btn:hover {
  border-color: var(--gpon-primary);
  color: var(--gpon-primary);
}

.abertas-popup-filtro-btn:focus-visible {
  outline: 2px solid var(--gpon-primary);
  outline-offset: 1px;
}

.abertas-popup-filtro-btn.is-ativo {
  background: var(--gpon-primary);
  border-color: var(--gpon-primary);
  color: #fff;
}

/* Botão "Massivas" com um toque de vermelho mesmo inativo (identificação
   rápida, seção 4) — sem exagerar: só o ícone/contador, nunca o botão
   inteiro pintado quando não está selecionado. */
.abertas-popup-filtro-massivas {
  color: #b91c1c;
  border-color: #fecaca;
}

.abertas-popup-filtro-massivas:hover {
  border-color: #dc2626;
  color: #dc2626;
}

.abertas-popup-filtro-massivas.is-ativo {
  background: #dc2626;
  border-color: #dc2626;
  color: #fff;
}

.abertas-popup-filtro-count {
  font-size: 10px;
  opacity: .85;
}

/* Estado zerado (grupo vazio) — visível, mas sem ação, mesmo padrão dos
   filtros rápidos de Status Análise da aba Eficiência (Fase 2). */
.abertas-popup-filtro-btn.is-zerado {
  opacity: .5;
  cursor: not-allowed;
}

.abertas-popup-filtro-btn.is-zerado:hover {
  border-color: var(--gpon-border);
  color: var(--gpon-muted);
}

.abertas-popup-filtro-massivas.is-zerado:hover {
  border-color: #fecaca;
  color: #b91c1c;
}

.abertas-popup-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}

.abertas-popup-card {
  position: relative;
  border: 1px solid var(--gpon-border);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--gpon-bg);
  min-width: 0;
}

/* Destaque visual das massivas (seção 4) — borda lateral vermelha + fundo
   levemente destacado, mesma paleta vermelha já usada no projeto (ex.:
   .efic-state-error/.efic-afetacao-vermelho), sem inventar uma nova. */
.abertas-popup-card.is-massiva {
  border-color: #fecaca;
  border-left: 3px solid #dc2626;
  background: #fef2f2;
}

.abertas-popup-card-copy {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--gpon-border);
  border-radius: 5px;
  background: #fff;
  color: var(--gpon-muted);
  font-size: 11px;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s, background .15s, color .15s, border-color .15s;
}

.abertas-popup-card:hover .abertas-popup-card-copy,
.abertas-popup-card-copy:focus-visible {
  opacity: 1;
}

.abertas-popup-card-copy:hover {
  background: var(--gpon-bg);
  color: var(--gpon-primary);
  border-color: var(--gpon-primary);
}

.abertas-popup-card-copy.copied {
  opacity: 1;
  color: #16a34a;
  border-color: #86efac;
  background: #f0fdf4;
}

/* Badge "Massiva de Grande Afetação" (seção 4) — pílula vermelha com
   ícone, não mais texto solto; mesma paleta de .abertas-popup-card.is-
   massiva (borda/fundo), aplicada aqui em versão sólida para contraste. */
.abertas-popup-massiva {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: #fff;
  background: #dc2626;
  padding: 2px 7px;
  border-radius: 10px;
  margin-bottom: 6px;
}

.abertas-popup-line {
  font-size: 12px;
  line-height: 1.6;
  color: var(--gpon-text);
  overflow-wrap: break-word;
  word-break: break-word;
}

.abertas-popup-city {
  font-weight: 700;
  color: #0e7490;
  font-size: 11px;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.abertas-popup-gpon {
  font-weight: 700;
}

.abertas-popup-sp {
  color: var(--gpon-muted);
  font-size: 11px;
}

.abertas-popup-empresa,
.abertas-popup-data {
  color: var(--gpon-muted);
  font-size: 11px;
}

@media (max-width: 480px) {
  .abertas-popup-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Popup Histórico SIGMA ──────────────────────────────────── */
#sigma-history-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1059;
  background: rgba(0, 0, 0, .22);
}

.sigma-history-popup {
  /* top/left/max-height são definidos via JS (openSigmaHistoryPopup),
     ancorados no botão que abriu o popup — os valores abaixo são só
     um fallback caso o JS de posicionamento não rode. */
  position: fixed;
  top: 64px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1060;
  background: var(--gpon-surface);
  border: 1px solid var(--gpon-border);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .22);
  width: min(500px, 92vw);
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  font-size: 13px;
}

/* Especificidade de ID > .sigma-history-popup (regra acima), então este
   "scale(1)" já vence o "translateX(-50%)" de fallback quando o JS de
   posicionamento roda (o que sempre acontece em produção) — não precisa
   mais zerar o transform via JS. Anima abertura/fechamento por escala,
   ancorada no transform-origin calculado em _positionSigmaPopup. */
#sigma-history-popup {
  transform: scale(1);
  opacity: 1;
  transition: transform .18s cubic-bezier(.34, 1.56, .64, 1), opacity .14s ease;
}

/* Estado inicial da animação de abertura — aplicado por um instante antes
   de remover a classe (ver openSigmaHistoryPopup em gpon.js), com origem
   no ponto do botão clicado (transform-origin definido dinamicamente). */
#sigma-history-popup.sigma-history-popup-enter {
  transform: scale(.35);
  opacity: 0;
}

.sigma-history-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--gpon-border);
  gap: 8px;
  flex-shrink: 0;
  background: linear-gradient(135deg, #ecfeff 0%, #cffafe 100%);
  border-radius: 10px 10px 0 0;
}

.sigma-history-title {
  font-weight: 700;
  font-size: 12px;
  color: #0e7490;
  letter-spacing: .04em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 7px;
}

.sigma-history-subtitle {
  font-family: 'IBM Plex Mono', monospace;
}

.sigma-history-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* Conteúdo interno do popup: coluna de revisão (esquerda) + histórico
   SIGMA (direita). Cada lado rola de forma independente — não há rolagem
   aninhada (uma dentro da outra). */
.sigma-history-content {
  display: flex;
  flex-direction: row;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Painel fixo — sempre expandido, sem mecanismo de recolher/expandir. */
.sigma-revisao-panel {
  width: 260px;
  flex: 0 0 260px;
  overflow-y: auto;
  padding: 8px 10px;
  border-right: 1px solid var(--gpon-border);
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: #faf8ff;
}

.sigma-revisao-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--gpon-primary);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.sigma-revisao-title span {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── Revisão da OC: botão de edição + modo de leitura ────────── */
.sigma-revisao-edit-btn {
  background: none;
  border: 1px solid transparent;
  color: var(--gpon-primary);
  width: 22px;
  height: 22px;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  font-size: 12px;
  text-transform: none;
  letter-spacing: normal;
  transition: background .15s, border-color .15s;
}

.sigma-revisao-edit-btn:hover {
  background: rgba(124, 58, 237, .12);
  border-color: rgba(124, 58, 237, .25);
}

.sigma-revisao-view {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sigma-revisao-view-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--gpon-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* Resumo informativo, não formulário: sem borda de campo, fundo em bloco
   compacto — o ícone fica fora do <span> que recebe o textContent (JS
   continua só trocando o texto do span, nunca o innerHTML do bloco). */
.sigma-revisao-view-data-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  max-width: 100%;
  background: #efe9fc;
  border-radius: 6px;
  padding: 8px 9px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--gpon-text);
}

.sigma-revisao-view-data-chip .bi-calendar3 {
  font-size: 12px;
  color: var(--gpon-primary);
  flex-shrink: 0;
}

.sigma-revisao-view-obs-text {
  font-size: 12px;
  color: var(--gpon-text);
  font-weight: 500;
  background: transparent;
  padding: 2px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.5;
}

.sigma-revisao-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 2px;
}

.sigma-revisao-cancel-btn {
  height: 28px;
  min-height: 28px;
  padding: 2px 10px;
  font-size: 12px;
  border-radius: 5px;
}

.sigma-revisao-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sigma-revisao-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--gpon-muted);
  margin-top: 0;
}

.sigma-revisao-input {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
}

.sigma-revisao-textarea {
  font-size: 12px;
  resize: vertical;
  min-height: 40px;
}

.sigma-revisao-counter {
  font-size: 10px;
  color: var(--gpon-muted);
  text-align: right;
  margin-top: -2px;
}

.sigma-revisao-save-btn {
  align-self: flex-end;
  height: 28px;
  min-height: 28px;
  padding: 2px 8px;
  font-size: 12px;
  line-height: 1;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-top: 2px;
  width: auto;
  min-width: 0;
}

.sigma-revisao-save-btn i {
  font-size: 11px;
}

.sigma-revisao-status {
  font-size: 11px;
  color: var(--gpon-muted);
  text-align: right;
  min-height: 14px;
}

.sigma-history-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

@media (max-width: 768px) {
  .sigma-history-content {
    flex-direction: column;
    overflow-y: auto;
  }

  .sigma-revisao-panel {
    width: 100%;
    flex: 0 0 auto;
    max-width: none;
    border-right: none;
    border-bottom: 1px solid var(--gpon-border);
    overflow-y: visible;
  }

  .sigma-history-main {
    min-height: 160px;
  }
}

.sigma-history-loading {
  padding: 24px;
  text-align: center;
  color: var(--gpon-muted);
  font-size: 13px;
}

.sigma-history-loading i {
  font-size: 22px;
  display: block;
  margin-bottom: 8px;
}

.sigma-history-body {
  overflow-y: auto;
  padding: 14px 16px;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sigma-history-card {
  border: 1px solid var(--gpon-border);
  border-left: 3px solid #06b6d4;
  border-radius: 6px;
  padding: 12px 14px;
  background: var(--gpon-bg);
}

.sigma-history-card-hdr {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--gpon-border);
}

.sigma-history-user {
  font-weight: 700;
  color: var(--gpon-text);
  font-size: 12.5px;
}

.sigma-history-date {
  font-size: 11px;
  color: var(--gpon-muted);
  font-family: 'IBM Plex Mono', monospace;
  white-space: nowrap;
}

.sigma-history-obs {
  font-size: 12.5px;
  color: var(--gpon-text);
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.sigma-history-empty {
  color: var(--gpon-muted);
  font-size: 12px;
  text-align: center;
  padding: 24px;
}

.sigma-history-empty.sigma-history-error {
  color: #b91c1c;
}

@media (max-width: 480px) {
  .sigma-history-card-hdr {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }
}

/* ── Link TA → SIGITM ─────────────────────────────────────── */
.ta-link {
  color: inherit;
  text-decoration: none;
}

.ta-link:hover .mono {
  color: var(--gpon-purple, #7c3aed);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

/* ══════════════════════════════════════════════════════════
   Afetação — botão na coluna OC + modal de detalhamento
   (#modalAfetacao, preenchido por assets/js/gpon.js)
═══════════════════════════════════════════════════════════ */

/* Botão na coluna OC — aparência de link operacional, sem
   aumentar a altura da linha da tabela principal. */
.oc-afetacao-btn {
  display: inline-block;
  max-width: 100%;
  margin: 0;
  padding: 1px 5px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--gpon-primary);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  text-align: left;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}

.oc-afetacao-btn:hover {
  background: #f5f3ff;
  border-color: var(--gpon-border);
  color: var(--gpon-primary-dark);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.oc-afetacao-btn:focus-visible {
  outline: 2px solid var(--gpon-primary);
  outline-offset: 1px;
}

/* Cabeçalho do modal */
#modalAfetacao .modal-header {
  align-items: flex-start;
}

#modalAfetacao .afet-sub {
  margin-top: 3px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, .85);
}

/* Estados textuais (carregando / erro / timeout / etc.) */
.afet-state {
  padding: 30px 16px;
  text-align: center;
  color: var(--gpon-muted);
  font-size: 14px;
}

.afet-state .afet-retry-btn {
  margin-left: 8px;
  vertical-align: baseline;
}

/* Indicadores compactos (Total, Rua, Prédio) — também filtros rápidos */
.afet-kpis {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.afet-kpi {
  position: relative;
  flex: 1 1 130px;
  min-height: 56px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 8px 12px;
  border: 1px solid var(--gpon-border);
  border-radius: var(--radius-md);
  background: #faf9ff;
}

/* Versão clicável (botão) — mantém o layout do card */
button.afet-kpi-filter {
  width: 100%;
  margin: 0;
  font: inherit;
  text-align: left;
  color: inherit;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}

button.afet-kpi-filter:hover:not(:disabled) {
  background: #f3effe;
  border-color: var(--gpon-primary-light);
}

button.afet-kpi-filter:focus-visible {
  outline: 2px solid var(--gpon-primary);
  outline-offset: 2px;
}

/* Estado ativo — cor + borda + indicador "Filtro ativo" (não depende só da cor) */
.afet-kpi-filter.afet-kpi-ativo {
  box-shadow: inset 3px 0 0 currentColor;
}

.afet-kpi-todos.afet-kpi-ativo {
  background: #faf5ff;
  border-color: #a855f7;
  color: #7c3aed;
}

.afet-kpi-rua.afet-kpi-ativo {
  background: #eff6ff;
  border-color: #3b82f6;
  color: #1d4ed8;
}

.afet-kpi-predio.afet-kpi-ativo {
  background: #f5f3ff;
  border-color: #7c3aed;
  color: #6d28d9;
}

/* KPI desabilitado (valor zero) — aparência neutra, sem filtro */
.afet-kpi-filter:disabled,
.afet-kpi-filter.afet-kpi-off {
  cursor: not-allowed;
  opacity: .6;
  background: #f4f4f6;
  box-shadow: none;
}

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

.afet-kpi-value {
  margin-top: 2px;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--gpon-text);
}

/* Indicador compacto "Filtro ativo" — canto superior direito, não altera a altura */
.afet-kpi-flag {
  position: absolute;
  top: 6px;
  right: 8px;
  display: none;
  align-items: center;
  gap: 3px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: currentColor;
}

.afet-kpi-ativo .afet-kpi-flag {
  display: inline-flex;
}

@media (prefers-reduced-motion: reduce) {
  button.afet-kpi-filter {
    transition: none;
  }
}

/* Cabeçalho da tabela + botão Exportar Excel na mesma linha do título */
.afet-table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.afet-btn-excel {
  white-space: nowrap;
}

/* Aviso discreto de inconsistência Rua + Prédio ≠ Total */
.afet-consistency {
  margin-bottom: 12px;
  padding: 8px 12px;
  border: 1px solid #fde68a;
  border-radius: var(--radius-sm);
  background: #fffbeb;
  color: #92400e;
  font-size: 12px;
}

/* Mensagem "sem registros" (KPIs continuam visíveis, zerados) */
.afet-empty {
  padding: 26px 16px;
  text-align: center;
  color: var(--gpon-muted);
  font-size: 14px;
}

.afet-table-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--gpon-text);
}

.afet-table-head>.afet-table-title {
  margin-bottom: 0;
}

/* A rolagem interna (horizontal + vertical) e o cabeçalho estável são
   entregues pelo DataTables (scrollX + scrollY); nenhum wrapper extra. */
.afet-table-wrap {
  width: 100%;
}

#tabela-afetacao-modal {
  font-size: 12px;
}

#tabela-afetacao-modal_wrapper .dataTables_scrollHead th {
  background: #f8f7ff;
  color: #5b21b6;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  white-space: nowrap;
}

#tabela-afetacao-modal tbody td {
  font-size: 12px;
  white-space: nowrap;
}

#tabela-afetacao-modal_wrapper .dataTables_filter input {
  width: 200px;
}

.afet-badge {
  display: inline-block;
  min-width: 62px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  text-align: center;
}

.afet-badge-predio {
  color: #fff;
  background: var(--gpon-primary);
}

.afet-badge-rua {
  color: #0e7490;
  background: #cffafe;
}

.afet-ind {
  display: inline-block;
  min-width: 24px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.afet-ind-pos {
  color: #fff;
  background: var(--gpon-primary);
}

.afet-ind-zero {
  color: #6b7280;
  background: #eef2f7;
}

@media (max-width: 575px) {
  .afet-kpi {
    flex-basis: 100%;
  }

  .afet-table-wrap {
    max-height: 60vh;
  }
}