/* Painel Gerencial */
.painel-module {
  padding: 32px;
  background: var(--gray-050);
}

.painel-header {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-bottom: 24px;
  padding: 18px;
  border-radius: 22px;
  background: #fff;
  border: 1px solid var(--gray-200);
  box-shadow: 0 14px 34px rgba(15,23,42,0.06);
}

@media (min-width: 900px) {
  .painel-header {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
  }
}

.painel-title-block {
  max-width: 720px;
}

.painel-eyebrow,
.painel-sync-label,
.painel-kpi-label {
  display: block;
  color: var(--gray-500);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.painel-title-block h1 {
  margin: 4px 0 0;
  color: var(--gray-950);
  font-size: 2rem;
  font-weight: 900;
  line-height: 1.05;
}

.painel-subtitle {
  margin: 10px 0 0;
  color: var(--gray-600);
  font-size: 0.95rem;
  line-height: 1.5;
}

.painel-sync-card {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 10px 16px;
  border: 1px solid var(--gray-200);
  border-radius: 14px;
  background: #fff;
  color: var(--gray-950);
  box-shadow: 0 10px 24px rgba(15,23,42,0.05);
}

.painel-sync-card strong {
  display: block;
  margin-top: 2px;
  font-size: 0.82rem;
}

.painel-sync-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 5px rgba(22,163,74,0.12);
}

.painel-refresh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 45px;
  padding: 0 18px;
  border: none;
  border-radius: 12px;
  background: var(--red-600, #dc2626);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
  transition: background 0.15s, transform 0.15s, opacity 0.15s;
  white-space: nowrap;
}

.painel-refresh-btn:hover {
  background: var(--red-700, #b91c1c);
}

.painel-refresh-btn:disabled {
  opacity: 0.7;
  cursor: default;
}

.painel-refresh-btn.is-loading svg {
  animation: painelSpin 0.9s linear infinite;
}

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

.painel-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 22px;
  padding: 20px;
  border: 1px solid var(--gray-200);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 12px 25px rgba(15,23,42,0.06);
}

.painel-filter-group {
  display: flex;
  flex: 1 1 220px;
  flex-direction: column;
  gap: 6px;
}

.painel-filter-group label {
  color: var(--gray-500);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.painel-filter-group select {
  min-height: 44px;
  border: 1px solid var(--gray-200);
  border-radius: 14px;
  background-color: #fff;
  color: var(--gray-950);
  font-size: 0.9rem;
  font-weight: 700;
  padding: 12px 14px;
}

.painel-filter-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--gray-100);
  border-radius: 14px;
  background: var(--gray-050);
  color: var(--gray-600);
  font-size: 0.75rem;
  font-weight: 900;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.painel-filter-clear:hover {
  border-color: var(--danger);
  background: rgba(254,242,242,0.92);
  color: var(--danger);
}

.painel-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}

.painel-kpi-card {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
  min-height: 130px;
  padding: 24px;
  border: 1px solid var(--gray-200);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 12px 25px rgba(15,23,42,0.06);
  transition: box-shadow 0.18s ease, transform 0.18s ease;
}

.painel-kpi-card:hover {
  box-shadow: 0 18px 35px rgba(15,23,42,0.12);
  transform: translateY(-1px);
}

.painel-kpi-icon {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  border-radius: 16px;
}

.painel-kpi-blue { background: #eff6ff; color: var(--primary); }
.painel-kpi-green { background: #f0fdf4; color: var(--success); }
.painel-kpi-orange { background: #fff7ed; color: var(--warning); }
.painel-kpi-red { background: var(--red-050); color: var(--danger); }
.painel-kpi-purple { background: #f5f3ff; color: var(--info); }

.painel-kpi-card > div:last-child {
  min-width: 0;
}

.painel-kpi-value {
  display: block;
  overflow-wrap: anywhere;
  margin-top: 4px;
  color: var(--gray-950);
  font-size: 1.45rem;
  font-weight: 900;
  line-height: 1.2;
}

.painel-kpi-sub {
  display: block;
  margin-top: 5px;
  color: var(--gray-500);
  font-size: 0.75rem;
  font-weight: 700;
}

.painel-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
}

@media (min-width: 1180px) {
  .painel-main-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .painel-card-wide {
    grid-column: 1 / -1;
  }
}

.painel-analysis-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
}

@media (min-width: 1180px) {
  .painel-analysis-grid {
    grid-template-columns: minmax(0, 1fr) minmax(360px, 0.62fr);
  }
}

.painel-card {
  min-width: 0;
  padding: 22px;
  border: 1px solid var(--gray-300, #d1d5db);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.painel-card-header {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 18px;
}

.painel-card-header h2 {
  margin: 0;
  color: var(--gray-950, #111827);
  font-size: 1.05rem;
  font-weight: 850;
  line-height: 1.25;
}

.painel-card-header p {
  margin: 4px 0 0;
  color: var(--gray-500, #6b7280);
  font-size: 0.76rem;
  font-weight: 650;
}

.painel-card-badge,
.painel-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--gray-100, #f3f4f6);
  color: var(--gray-600, #4b5563);
  font-size: 0.625rem;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}

.painel-pill-green {
  background: #f0fdf4;
  color: #15803d;
}

.painel-pill-red {
  background: var(--red-050, #fef2f2);
  color: var(--red-700, #b91c1c);
}

.painel-unidade-list,
.painel-ranking-list,
.painel-opportunity-list,
.painel-funnel-list,
.painel-loss-list {
  display: grid;
  gap: 10px;
}

.painel-unidade-list {
  grid-template-columns: 1fr;
  margin-bottom: 18px;
}

@media (min-width: 760px) {
  .painel-unidade-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1180px) {
  .painel-unidade-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.painel-unit-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--gray-300, #d1d5db);
  border-radius: 12px;
  background: #fff;
}

.painel-unit-top,
.painel-rank-top,
.painel-opp-top,
.painel-funnel-top,
.painel-loss-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.painel-unit-name,
.painel-rank-name,
.painel-opp-name,
.painel-funnel-name,
.painel-loss-name {
  overflow: hidden;
  margin: 0;
  color: var(--gray-950, #111827);
  font-size: 0.82rem;
  font-weight: 850;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.painel-unit-meta,
.painel-rank-meta,
.painel-opp-meta,
.painel-funnel-meta,
.painel-loss-meta {
  margin: 3px 0 0;
  color: var(--gray-600, #4b5563);
  font-size: 0.66rem;
  font-weight: 750;
}

.painel-unit-money,
.painel-rank-money,
.painel-opp-money,
.painel-loss-money {
  flex: 0 0 auto;
  color: var(--gray-950, #111827);
  font-size: 0.85rem;
  font-weight: 900;
  white-space: nowrap;
}

.painel-progress {
  height: 8px;
  overflow: hidden;
  margin-top: 12px;
  border-radius: 999px;
  background: var(--gray-200, #e5e7eb);
}

.painel-progress-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--red-600, #dc2626);
  transition: width 0.45s ease;
}

.painel-unit-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  color: var(--gray-600, #4b5563);
  font-size: 0.68rem;
  font-weight: 750;
}

.painel-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--gray-100, #f3f4f6);
  border-radius: 12px;
}

.painel-table-wrap-compact {
  margin-top: 14px;
}

.painel-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.painel-table th,
.painel-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--gray-100, #f3f4f6);
  text-align: left;
  vertical-align: middle;
}

.painel-table th {
  background: var(--gray-050, #f9fafb);
  color: var(--gray-600, #4b5563);
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
  white-space: nowrap;
}

.painel-table td {
  color: var(--gray-700, #374151);
  font-weight: 650;
}

.painel-table tbody tr:hover td {
  background: var(--gray-050, #f9fafb);
}

.painel-table tbody tr:last-child td {
  border-bottom: none;
}

.painel-money {
  color: var(--gray-950, #111827);
  font-weight: 900;
  white-space: nowrap;
}

.painel-muted {
  color: var(--gray-600, #4b5563);
  font-weight: 700;
}

.painel-rank-row,
.painel-opp-row,
.painel-funnel-row,
.painel-loss-row {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--gray-200);
  border-radius: 18px;
  background: #fff;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
  box-shadow: 0 10px 24px rgba(15,23,42,0.05);
}

.painel-rank-row:hover,
.painel-opp-row:hover,
.painel-funnel-row:hover,
.painel-loss-row:hover {
  border-color: rgba(220,38,38,0.25);
  background: rgba(254,242,242,0.85);
  transform: translateY(-1px);
  box-shadow: 0 16px 32px rgba(15,23,42,0.09);
}

.painel-rank-left,
.painel-opp-left,
.painel-funnel-left,
.painel-loss-left {
  display: flex;
  min-width: 0;
  gap: 12px;
  align-items: flex-start;
}

.painel-rank-medal {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 14px;
  background: rgba(254,242,242,0.9);
  color: var(--danger);
  font-size: 0.75rem;
  font-weight: 900;
}

.painel-rank-row:first-child .painel-rank-medal {
  background: rgba(254,240,189,0.9);
  color: var(--warning);
}

.painel-rank-foot,
.painel-opp-foot,
.painel-funnel-foot,
.painel-loss-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}

.painel-rank-foot small,
.painel-opp-foot small,
.painel-funnel-foot small,
.painel-loss-foot small {
  color: var(--gray-500);
  font-size: 0.72rem;
  font-weight: 700;
}

.painel-opp-phase {
  display: inline-flex;
  align-items: center;
  max-width: 170px;
  min-height: 22px;
  padding: 3px 8px;
  border-radius: 999px;
  color: #fff;
  font-size: 0.58rem;
  font-weight: 900;
  line-height: 1.1;
  text-transform: uppercase;
}

.painel-funnel-row {
  background: var(--gray-050, #f9fafb);
}

.painel-loss-row {
  background: var(--red-050, #fef2f2);
}

.painel-funnel-track {
  height: 9px;
  overflow: hidden;
  margin-top: 10px;
  border-radius: 999px;
  background: var(--gray-200, #e5e7eb);
}

.painel-funnel-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--red-600, #dc2626);
  transition: width 0.45s ease;
}

.painel-loss-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--red-600, #dc2626);
  transition: width 0.45s ease;
}

.painel-empty {
  padding: 28px 16px;
  border: 1px dashed var(--gray-200, #e5e7eb);
  border-radius: 12px;
  background: var(--gray-050, #f9fafb);
  color: var(--gray-500, #6b7280);
  font-size: 0.8rem;
  font-weight: 750;
  text-align: center;
}

.painel-card.is-loading .painel-empty,
.painel-module.is-loading .painel-empty {
  color: var(--gray-600, #4b5563);
}

.painel-module.is-loading .painel-sync-dot {
  background: var(--orange, #f97316);
  box-shadow: 0 0 0 5px rgba(249, 115, 22, 0.12);
}

@media (max-width: 760px) {
  .painel-module {
    padding: 18px;
  }

  .painel-refresh-btn,
  .painel-sync-card,
  .painel-filter-clear {
    width: 100%;
  }

  .painel-card {
    padding: 18px;
  }

  .painel-card-header {
    flex-direction: column;
  }

  .painel-kpi-card {
    align-items: flex-start;
  }

  .painel-table {
    min-width: 680px;
  }
}
