.dashboard-applications {
  width: 100%;
  padding: 20px;
}

.dashboard-applications .page-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border, #e5e7eb);
}

.dashboard-applications .header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.dashboard-applications .page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary, #1f2937);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.dashboard-applications .page-title i {
  color: var(--primary-color);
  font-size: 1.25rem;
}

.dashboard-applications .page-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary, #6b7280);
  margin: 0.2rem 0 0;
}

.dashboard-applications .header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--surface-hover, #f9fafb);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  padding: 0.45rem 0.9rem 0.45rem 1.1rem;
  flex-shrink: 0;
  width: 320px;
}

.dashboard-applications .date-range-selector {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex: 1;
  min-width: 0;
}

.dashboard-applications .date-range-selector .cs-container {
  flex: 1;
  min-width: 0;
}

.dashboard-applications .date-range-selector label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary, #6b7280);
  white-space: nowrap;
}

.dashboard-applications .filter-select {
  padding: 7px 32px 7px 10px;
  border: none;
  border-radius: 6px;
  font-size: 0.925rem;
  font-weight: 500;
  background-color: transparent;
  color: var(--text-primary, #1f2937);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  transition: color 0.2s;
}

.dashboard-applications .filter-select:focus {
  outline: none;
}

.dashboard-applications .btn-refresh-inline {
  background: none;
  border: none;
  padding: 5px 8px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-secondary, #6b7280);
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 500;
  transition: color 0.2s;
}

.dashboard-applications .btn-refresh-inline:hover {
  color: var(--primary-color);
}

.dashboard-applications .kpi-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.dashboard-applications .kpi-card {
  background-color: var(--card-bg, #ffffff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 16px;
  padding: 1.25rem 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: all 0.3s;
}

.dashboard-applications .kpi-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.dashboard-applications .kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.dashboard-applications .kpi-icon-total {
  background-color: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
}
.dashboard-applications .kpi-icon-completed {
  background-color: rgba(16, 185, 129, 0.1);
  color: #10b981;
}
.dashboard-applications .kpi-icon-progress {
  background-color: rgba(251, 191, 36, 0.1);
  color: #fbbf24;
}
.dashboard-applications .kpi-icon-overdue {
  background-color: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}
.dashboard-applications .kpi-icon-avg {
  background-color: rgba(139, 92, 246, 0.1);
  color: #8b5cf6;
}

.dashboard-applications .kpi-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.dashboard-applications .kpi-label {
  font-size: 0.8rem;
  color: var(--text-secondary, #6b7280);
  font-weight: 500;
}

.dashboard-applications .kpi-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary, #1f2937);
  line-height: 1;
}

.dashboard-applications .kpi-change {
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.dashboard-applications .kpi-positive {
  color: #10b981;
}
.dashboard-applications .kpi-negative {
  color: #ef4444;
}
.dashboard-applications .kpi-neutral {
  color: var(--text-secondary, #9ca3af);
}

.dashboard-middle-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.dashboard-left-column,
.dashboard-right-column {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}

/* Cards Gerais */
.dashboard-applications .chart-card {
  background-color: var(--card-bg, #ffffff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 16px;
  padding: 1.5rem;
}

/* Lado Esquerdo: Cards Duplos de Gráficos (Pizzas) */
.double-chart .double-chart-header {
  display: flex;
  justify-content: space-around;
  border-bottom: 1px solid var(--border, #e5e7eb);
  padding-bottom: 1rem;
  margin-bottom: 1rem;
}

.double-chart .chart-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary, #1f2937);
  text-align: center;
  flex: 1;
}

.double-chart .double-chart-body {
  display: flex;
  justify-content: space-around;
  gap: 15px;
  min-height: 200px;
}

.double-chart .chart-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  max-width: 100%;
}

/* Lado Direito: Botões de Ação */
.action-buttons-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.action-btn-card {
  height: 90px;
  border-radius: 16px;
  border: 1px solid var(--border, #e5e7eb);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s;
}

.action-btn-card.highlight {
  background-color: var(--card-bg, #ffffff);
  color: var(--text-primary, #1f2937);
}

.action-btn-card.highlight:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  border-color: var(--primary-color);
}

.action-btn-card.empty {
  background-color: var(--primary-color);
  border: 1px solid var(--border, #e5e7eb);
  cursor: default;
}

/* Workflow Stats Card */
.action-btn-card.workflow-stats-card {
  height: auto;
  min-height: 120px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 1rem 1.1rem;
  gap: 0.6rem;
}

.workflow-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary, #1f2937);
}

.workflow-card-header i {
  color: var(--primary-color);
  font-size: 0.9rem;
}

.workflow-stats-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  width: 100%;
}

.workflow-stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
}

.workflow-stat-label {
  color: var(--text-secondary, #6b7280);
  font-weight: 500;
}

.workflow-stat-value {
  font-weight: 700;
  color: var(--text-primary, #1f2937);
  font-size: 0.9rem;
}

html.dark-theme .workflow-card-header,
html.dark-theme .workflow-stat-value {
  color: #f0f0f0;
}

html.dark-theme .workflow-stat-label {
  color: #aaaaaa;
}

/* Lado Direito: Gráfico de Ondas */
.wave-chart-card {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.dashboard-applications .chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border, #e5e7eb);
}

.dashboard-applications .chart-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary, #1f2937);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dashboard-applications .chart-actions {
  display: flex;
  gap: 0.75rem;
}

.dashboard-applications .chart-select {
  padding: 6px 10px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 6px;
  font-size: 0.8125rem;
  background-color: var(--input-bg, #ffffff);
  color: var(--text-primary, #1f2937);
  cursor: pointer;
}

.dashboard-applications .chart-body {
  position: relative;
  flex-grow: 1;
  min-height: 250px;
}

/* ═══════════════════════════════════════════
   RECENTES
═══════════════════════════════════════════ */
.dashboard-applications .recent-applications-card {
  background-color: var(--card-bg, #ffffff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 2rem;
}

.dashboard-applications .recent-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border, #e5e7eb);
}

.dashboard-applications .recent-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary, #1f2937);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dashboard-applications .recent-title i {
  color: var(--primary-color);
  font-size: 0.875rem;
}

.dashboard-applications .recent-body {
  padding: 1rem;
}

.dashboard-applications .recent-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.dashboard-applications .recent-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background-color: var(--surface-hover, #f9fafb);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.dashboard-applications .recent-item:hover {
  background-color: var(--border, #e5e7eb);
  transform: translateX(4px);
}

.dashboard-applications .recent-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.dashboard-applications .recent-checklist {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary, #1f2937);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashboard-applications .recent-assignee {
  font-size: 0.8125rem;
  color: var(--text-secondary, #9ca3af);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashboard-applications .recent-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.dashboard-applications .recent-status {
  padding: 4px 10px;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 600;
}

.dashboard-applications .recent-progress {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--primary-color);
  min-width: 40px;
  text-align: right;
}

.dashboard-applications .recent-loading,
.dashboard-applications .recent-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  color: var(--text-secondary, #6b7280);
}

/* ═══════════════════════════════════════════
   ALERTAS E OVERLAYS
═══════════════════════════════════════════ */
.dashboard-applications .overdue-alert-card {
  background-color: var(--card-bg, #ffffff);
  border: 1px solid #ef4444;
  border-left: 4px solid #ef4444;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 2rem;
}

.dashboard-applications .alert-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  background-color: rgba(239, 68, 68, 0.05);
  border-bottom: 1px solid var(--border, #e5e7eb);
}

.dashboard-applications .alert-title {
  font-size: 1rem;
  font-weight: 600;
  color: #dc2626;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dashboard-applications .alert-count {
  background-color: #dc2626;
  color: white;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.875rem;
  font-weight: 700;
  min-width: 32px;
  text-align: center;
}

.dashboard-applications .alert-body {
  padding: 1rem;
}

.dashboard-applications .overdue-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.dashboard-applications .overdue-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background-color: rgba(239, 68, 68, 0.05);
  border-radius: 8px;
  border-left: 3px solid #ef4444;
  cursor: pointer;
  transition: all 0.2s;
}

.dashboard-applications .overdue-item:hover {
  background-color: rgba(239, 68, 68, 0.1);
  transform: translateX(4px);
}

.dashboard-applications .overdue-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.dashboard-applications .overdue-checklist {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary, #1f2937);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashboard-applications .overdue-assignee {
  font-size: 0.8125rem;
  color: var(--text-secondary, #9ca3af);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashboard-applications .overdue-days {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #dc2626;
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
}

.dashboard-applications .btn {
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
}

.dashboard-applications .btn-secondary {
  background-color: #ffffff;
  color: var(--text-primary, #1f2937);
  border: 1px solid var(--border, #e5e7eb);
}

.dashboard-applications .btn-secondary:hover {
  background-color: var(--surface-hover, #f9fafb);
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.dashboard-applications .btn-link {
  background: none;
  border: none;
  color: var(--primary-color);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 8px 12px;
  border-radius: 6px;
  transition: all 0.2s;
}

.dashboard-applications .btn-link:hover {
  background-color: var(--surface-hover, #f3f4f6);
}

.dashboard-applications .loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.dashboard-applications .loading-content {
  background-color: var(--card-bg, #ffffff);
  border-radius: 12px;
  padding: 2rem 3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.dashboard-applications .loading-content i {
  font-size: 2rem;
  color: var(--primary-color);
  animation: spin 1s linear infinite;
}

.dashboard-applications .loading-content p {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-primary, #1f2937);
  font-weight: 500;
}

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

/* ═══════════════════════════════════════════
   DARK THEME
═══════════════════════════════════════════ */
html.dark-theme .dashboard-applications .page-header {
  border-bottom-color: #555555;
}

html.dark-theme .dashboard-applications .header-right {
  background-color: #1e1e1e;
  border-color: #555555;
}

html.dark-theme .dashboard-applications .filter-select {
  color: #f0f0f0;
}

html.dark-theme .dashboard-applications .page-title,
html.dark-theme .dashboard-applications .kpi-value,
html.dark-theme .dashboard-applications .chart-title,
html.dark-theme .dashboard-applications .recent-title,
html.dark-theme .dashboard-applications .recent-checklist,
html.dark-theme .dashboard-applications .overdue-checklist {
  color: #f0f0f0;
}

html.dark-theme .dashboard-applications .page-subtitle,
html.dark-theme .dashboard-applications .kpi-label,
html.dark-theme .dashboard-applications .recent-assignee,
html.dark-theme .dashboard-applications .overdue-assignee {
  color: #b0b0b0;
}

html.dark-theme .dashboard-applications .kpi-card,
html.dark-theme .dashboard-applications .chart-card,
html.dark-theme .dashboard-applications .recent-applications-card,
html.dark-theme .dashboard-applications .overdue-alert-card,
html.dark-theme .dashboard-applications .loading-content,
html.dark-theme .action-btn-card.highlight {
  background-color: var(--background-dark-mode-menu-lateral);
  border-color: #555555;
}

html.dark-theme .action-btn-card.highlight {
  color: #f0f0f0;
}

html.dark-theme .action-btn-card.empty {
  border-color: #555555;
}

html.dark-theme .dashboard-applications .recent-item,
html.dark-theme .dashboard-applications .overdue-item {
  background-color: #1e1e1e;
}

html.dark-theme .dashboard-applications .recent-item:hover {
  background-color: #3a3a3a;
}

html.dark-theme .dashboard-applications .chart-select {
  background-color: #1e1e1e;
  color: #f0f0f0;
  border-color: #555555;
}

html.dark-theme .dashboard-applications .btn-secondary {
  background-color: #1e1e1e;
  color: #f0f0f0;
  border-color: #555555;
}

html.dark-theme .dashboard-applications .chart-header,
html.dark-theme .dashboard-applications .recent-header,
html.dark-theme .dashboard-applications .alert-header,
html.dark-theme .double-chart .double-chart-header {
  border-color: #555555;
}

html.dark-theme .dashboard-applications .btn-link:hover {
  background-color: #3a3a3a;
}

/* ═══════════════════════════════════════════
   RESPONSIVIDADE
═══════════════════════════════════════════ */
@media (max-width: 1024px) {
  .dashboard-middle-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .dashboard-applications {
    padding: 15px;
  }

  .dashboard-applications .kpi-cards {
    grid-template-columns: 1fr;
  }

  .double-chart .double-chart-body,
  .double-chart .double-chart-header {
    flex-direction: column;
    gap: 20px;
  }
}
