/* System Design System & Variables */
:root {
  --font-sans: 'Inter', sans-serif;
  --font-mono: 'Roboto Mono', monospace;

  /* Theme: Dark (Default) */
  --bg-app: #18181b;
  --bg-card: rgba(39, 39, 42, 0.45);
  --bg-card-hover: rgba(39, 39, 42, 0.7);
  --border-color: rgba(255, 255, 255, 0.08);
  --text-primary: #f4f4f5;
  --text-secondary: #a1a1aa;
  --primary: #e4e4e7;
  --primary-hover: #ffffff;
  --secondary: #878787;
  --primary-rgb: 228, 228, 231;
  
  --card-blur: blur(16px);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
  --transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);

  /* Status Colors */
  --status-pending-bg: rgba(245, 158, 11, 0.12);
  --status-pending-color: #f59e0b;
  --status-pending-border: rgba(245, 158, 11, 0.3);

  --status-loading-bg: rgba(59, 130, 246, 0.12);
  --status-loading-color: #3b82f6;
  --status-loading-border: rgba(59, 130, 246, 0.3);

  --status-success-bg: rgba(16, 185, 129, 0.12);
  --status-success-color: #10b981;
  --status-success-border: rgba(16, 185, 129, 0.3);

  --status-error-bg: rgba(239, 68, 68, 0.12);
  --status-error-color: #ef4444;
  --status-error-border: rgba(239, 68, 68, 0.3);
}

/* Light Theme Variables */
body.light-theme {
  --bg-app: #f7f7f7;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-hover: rgba(255, 255, 255, 0.95);
  --border-color: rgba(0, 0, 0, 0.08);
  --text-primary: #18181b;
  --text-secondary: #585858;
  --primary: #747474;
  --primary-hover: #585858;
  --secondary: #878787;
  --primary-rgb: 116, 116, 116;
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

/* Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.4s ease, color 0.4s ease;
  overflow-x: hidden;
  font-size: 13px;
  letter-spacing: 0.01em;
}

.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.75rem;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-logo-icon {
  width: 48px;
  height: 48px;
  background: #ffffff;
  border-radius: 14px;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.logo-area h1 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.logo-area p {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  border-radius: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  backdrop-filter: var(--card-blur);
  transition: var(--transition);
}

.btn-back:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.btn-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: var(--card-blur);
  transition: var(--transition);
  font-size: 1rem;
}

.btn-icon:hover {
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

/* Main Content Layout */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Loading Screen */
.loading-container {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  padding: 2.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  backdrop-filter: var(--card-blur);
  box-shadow: var(--shadow-lg);
}

.loading-header {
  text-align: center;
  max-width: 600px;
  margin: 0 auto;
}

.loading-spinner-main {
  font-size: 3rem;
  color: #6366f1;
  margin-bottom: 1rem;
}

.loading-header h2 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.loading-header p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.api-status-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

.api-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border-color);
  transition: var(--transition);
}

body.light-theme .api-card {
  background: rgba(0, 0, 0, 0.03);
}

.api-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  background: rgba(99, 102, 241, 0.15);
  color: #6366f1;
  margin-right: 1.25rem;
  flex-shrink: 0;
}

.api-card-info {
  flex: 1;
}

.api-endpoint {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 8px;
  border-radius: 6px;
  display: inline-block;
  margin-bottom: 4px;
}

.api-card-info h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.api-status-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.api-card-badge {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.api-card-badge .badge-status {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

.btn-card-retry {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 6px 12px;
  border-radius: 8px;
  background: #ef4444;
  color: #ffffff;
  border: none;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-card-retry:hover {
  background: #dc2626;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.api-card.status-pending { border-color: var(--status-pending-border); }
.api-card.status-pending .badge-status { background: var(--status-pending-bg); color: var(--status-pending-color); }

.api-card.status-loading { border-color: var(--status-loading-border); }
.api-card.status-loading .badge-status { background: var(--status-loading-bg); color: var(--status-loading-color); }

.api-card.status-success { border-color: var(--status-success-border); }
.api-card.status-success .badge-status { background: var(--status-success-bg); color: var(--status-success-color); }
.api-card.status-success .api-card-icon { background: rgba(16, 185, 129, 0.15); color: #10b981; }

.api-card.status-error { border-color: var(--status-error-border); }
.api-card.status-error .badge-status { background: var(--status-error-bg); color: var(--status-error-color); }
.api-card.status-error .api-card-icon { background: rgba(239, 68, 68, 0.15); color: #ef4444; }

.retry-container { text-align: center; margin-top: 1rem; }
.retry-buttons-group {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.btn-retry {
  padding: 0.75rem 1.75rem;
  border-radius: 12px;
  background: #ef4444;
  color: #ffffff;
  border: none;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--transition);
}
.btn-retry:hover { background: #dc2626; transform: translateY(-2px); box-shadow: 0 6px 20px rgba(239, 68, 68, 0.3); }

/* Dashboard Screen Layout */
.dashboard-container {
  display: flex;
  flex-direction: column;
  gap: 2.25rem;
}

.success-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.75rem;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 16px;
  backdrop-filter: var(--card-blur);
}

.success-banner-icon {
  font-size: 2rem;
  color: #10b981;
  margin-right: 1.25rem;
}

.success-banner-content { flex: 1; }
.success-banner-content h3 { font-size: 1.15rem; font-weight: 700; color: #10b981; margin-bottom: 2px; }
.success-banner-content p { font-size: 0.875rem; color: var(--text-secondary); }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  border-radius: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-secondary:hover { background: var(--bg-card-hover); transform: translateY(-2px); }

/* Summary KPI Grid */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

.summary-card {
  padding: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  backdrop-filter: var(--card-blur);
  box-shadow: var(--shadow-lg);
  transition: var(--transition);
}

.summary-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-4px);
}

.summary-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.summary-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.icon-blue { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.icon-green { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.icon-amber { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.icon-purple { background: rgba(168, 85, 247, 0.15); color: #a855f7; }

.summary-title { font-size: 0.9rem; font-weight: 600; color: var(--text-secondary); }
.summary-value { font-family: var(--font-mono); font-size: 2.2rem; font-weight: 700; line-height: 1.1; margin-bottom: 0.25rem; }
.summary-subtext { font-size: 0.8rem; color: var(--text-secondary); }

/* Controls Bar (Tabs & Global Search) */
.controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  backdrop-filter: var(--card-blur);
}

.section-tabs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dash-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  border-radius: 10px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.dash-tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.dash-tab-btn.active {
  background: #6366f1;
  color: #ffffff;
  border-color: #6366f1;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
}

/* Sub-Tabs dentro de cada Seção (Tabelas / Cards) */
.sub-tabs-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.4rem 0.5rem;
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  margin-top: 0.25rem;
}

body.light-theme .sub-tabs-bar {
  background: rgba(0, 0, 0, 0.03);
}

.sub-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-size: 0.825rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}

.sub-tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.sub-tab-btn.active {
  background: rgba(99, 102, 241, 0.15);
  color: #6366f1;
  border-color: rgba(99, 102, 241, 0.3);
}

body.light-theme .sub-tab-btn.active {
  background: #6366f1;
  color: #ffffff;
}

/* Cores dos Botões de Seleção da Seção 1 (Tabelas) */
/* Tabela 1 - Cinza */
.sub-tab-btn[data-table-view="central"]:hover {
  background: rgba(156, 163, 175, 0.12);
  color: var(--text-primary);
}
.sub-tab-btn[data-table-view="central"].active {
  background: rgba(156, 163, 175, 0.22);
  color: #e5e7eb;
  border-color: rgba(156, 163, 175, 0.45);
  box-shadow: 0 4px 14px rgba(107, 114, 128, 0.25);
}
body.light-theme .sub-tab-btn[data-table-view="central"].active {
  background: #6b7280;
  color: #ffffff;
  border-color: #6b7280;
}

/* Tabela 2 - Verde */
.sub-tab-btn[data-table-view="lojista"]:hover {
  background: rgba(16, 185, 129, 0.12);
  color: var(--text-primary);
}
.sub-tab-btn[data-table-view="lojista"].active {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
  border-color: rgba(16, 185, 129, 0.45);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.25);
}
body.light-theme .sub-tab-btn[data-table-view="lojista"].active {
  background: #10b981;
  color: #ffffff;
  border-color: #10b981;
}

/* Tabela 3 - Amarelo / Laranja */
.sub-tab-btn[data-table-view="pedidos"]:hover {
  background: rgba(245, 158, 11, 0.12);
  color: var(--text-primary);
}
.sub-tab-btn[data-table-view="pedidos"].active {
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.45);
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.25);
}
body.light-theme .sub-tab-btn[data-table-view="pedidos"].active {
  background: #f59e0b;
  color: #ffffff;
  border-color: #f59e0b;
}

/* Tabela 4 - Roxo */
.sub-tab-btn[data-table-view="propostas"]:hover {
  background: rgba(168, 85, 247, 0.12);
  color: var(--text-primary);
}
.sub-tab-btn[data-table-view="propostas"].active {
  background: rgba(168, 85, 247, 0.2);
  color: #a855f7;
  border-color: rgba(168, 85, 247, 0.45);
  box-shadow: 0 4px 14px rgba(168, 85, 247, 0.25);
}
body.light-theme .sub-tab-btn[data-table-view="propostas"].active {
  background: #a855f7;
  color: #ffffff;
  border-color: #a855f7;
}

.search-box {
  position: relative;
  min-width: 280px;
  flex: 1;
  max-width: 400px;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.search-box input {
  width: 100%;
  padding: 0.65rem 1rem 0.65rem 2.5rem;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 0.875rem;
  outline: none;
  transition: var(--transition);
}

body.light-theme .search-box input {
  background: rgba(255, 255, 255, 0.9);
}

.search-box input:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* Dash Section */
.dash-section {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.section-title-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.section-title-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(99, 102, 241, 0.15);
  color: #6366f1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.section-title-bar h2 { font-size: 1.35rem; font-weight: 700; margin-bottom: 2px; }
.section-title-bar p { font-size: 0.875rem; color: var(--text-secondary); }

/* SEÇÃO 1: TABELAS DE MOVIMENTAÇÃO */
.tables-stack {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.table-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  overflow: hidden;
  backdrop-filter: var(--card-blur);
  box-shadow: var(--shadow-lg);
}

.table-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.15);
}

/* Cores dos Cabeçalhos das Tabelas (table-card-header) */
/* Tabela 1 - Cinza */
.table-card[data-table-id="central"] {
  border-top: 2px solid rgba(156, 163, 175, 0.4);
}
.header-central {
  border-left: 4px solid #9ca3af;
  background: linear-gradient(90deg, rgba(156, 163, 175, 0.15) 0%, rgba(0, 0, 0, 0.15) 100%);
}
.header-central .table-card-title i {
  color: #9ca3af;
}
.header-central .table-count-badge {
  background: rgba(156, 163, 175, 0.18);
  border-color: rgba(156, 163, 175, 0.35);
  color: #e5e7eb;
}

/* Tabela 2 - Verde */
.table-card[data-table-id="lojista"] {
  border-top: 2px solid rgba(16, 185, 129, 0.4);
}
.header-lojista {
  border-left: 4px solid #10b981;
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.15) 0%, rgba(0, 0, 0, 0.15) 100%);
}
.header-lojista .table-card-title i {
  color: #10b981;
}
.header-lojista .table-count-badge {
  background: rgba(16, 185, 129, 0.18);
  border-color: rgba(16, 185, 129, 0.35);
  color: #34d399;
}

/* Tabela 3 - Amarelo / Laranja */
.table-card[data-table-id="pedidos"] {
  border-top: 2px solid rgba(245, 158, 11, 0.4);
}
.header-pedidos {
  border-left: 4px solid #f59e0b;
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.15) 0%, rgba(0, 0, 0, 0.15) 100%);
}
.header-pedidos .table-card-title i {
  color: #f59e0b;
}
.header-pedidos .table-count-badge {
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(245, 158, 11, 0.35);
  color: #fbbf24;
}

/* Tabela 4 - Roxo */
.table-card[data-table-id="propostas"] {
  border-top: 2px solid rgba(168, 85, 247, 0.4);
}
.header-propostas {
  border-left: 4px solid #a855f7;
  background: linear-gradient(90deg, rgba(168, 85, 247, 0.15) 0%, rgba(0, 0, 0, 0.15) 100%);
}
.header-propostas .table-card-title i {
  color: #a855f7;
}
.header-propostas .table-count-badge {
  background: rgba(168, 85, 247, 0.18);
  border-color: rgba(168, 85, 247, 0.35);
  color: #c084fc;
}

/* Suporte ao Tema Claro (Light Theme) */
body.light-theme .header-central {
  background: linear-gradient(90deg, rgba(107, 114, 128, 0.12) 0%, rgba(240, 240, 240, 0.6) 100%);
}
body.light-theme .header-central .table-card-title i { color: #4b5563; }
body.light-theme .header-central .table-count-badge {
  background: rgba(107, 114, 128, 0.15);
  border-color: rgba(107, 114, 128, 0.3);
  color: #374151;
}

body.light-theme .header-lojista {
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.12) 0%, rgba(240, 240, 240, 0.6) 100%);
}
body.light-theme .header-lojista .table-card-title i { color: #059669; }
body.light-theme .header-lojista .table-count-badge {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.3);
  color: #047857;
}

body.light-theme .header-pedidos {
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.12) 0%, rgba(240, 240, 240, 0.6) 100%);
}
body.light-theme .header-pedidos .table-card-title i { color: #d97706; }
body.light-theme .header-pedidos .table-count-badge {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.3);
  color: #b45309;
}

body.light-theme .header-propostas {
  background: linear-gradient(90deg, rgba(168, 85, 247, 0.12) 0%, rgba(240, 240, 240, 0.6) 100%);
}
body.light-theme .header-propostas .table-card-title i { color: #7e22ce; }
body.light-theme .header-propostas .table-count-badge {
  background: rgba(168, 85, 247, 0.15);
  border-color: rgba(168, 85, 247, 0.3);
  color: #6b21a8;
}

.table-card-title {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.table-card-title i {
  font-size: 1.25rem;
  color: var(--text-primary);
}

.table-card-title h3 {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.2;
}

.table-subtitle {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.table-subtitle code {
  font-family: var(--font-mono);
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 6px;
  border-radius: 4px;
}

.table-count-badge {
  padding: 4px 12px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  max-height: 400px;
}

.dash-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
  letter-spacing: 0.01em;
}

.dash-table tr {
  height: 32px;
}

.dash-table th {
  position: sticky;
  top: 0;
  background: rgba(24, 24, 27, 0.95);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  padding: 0 1.25rem;
  height: 32px;
  line-height: 32px;
  vertical-align: middle;
  border-bottom: 1px solid var(--border-color);
  z-index: 2;
}

body.light-theme .dash-table th {
  background: rgba(240, 240, 240, 0.95);
}

.dash-table td {
  padding: 0 1.25rem;
  height: 32px;
  line-height: 32px;
  vertical-align: middle;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 13px;
  letter-spacing: 0.01em;
}

.dash-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

body.light-theme .dash-table tbody tr:hover {
  background: rgba(0, 0, 0, 0.03);
}

.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--text-secondary); }

.num-highlight {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.01em;
}

.num-positive { color: #10b981; }
.num-negative { color: #ef4444; }
.num-zero { color: var(--text-secondary); }

/* SEÇÃO 2: CARDS / TABELAS PIVOT AGRUPADAS (ESTILO PRINT DA PLANILHA) */
.pivot-cards-grid {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.pivot-sheet-card {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  background: #1e1e1e;
}

body.light-theme .pivot-sheet-card {
  border: 1px solid rgba(0, 0, 0, 0.2);
  background: #ffffff;
}

/* Titulo Escuro Principal */
.sheet-title-header {
  background: #262626;
  padding: 0.85rem 1.5rem;
  text-align: center;
  border-bottom: 1px solid #333333;
}

.sheet-title-header h2 {
  font-size: 1.25rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.01em;
}

/* Subtítulo Claro/Linha Informativa */
.sheet-subtitle-header {
  background: #181818;
  padding: 0.6rem 1.5rem;
  border-bottom: 1px solid #333333;
  color: #d4d4d8;
  font-size: 13px;
  letter-spacing: 0.01em;
  font-weight: 500;
}

body.light-theme .sheet-subtitle-header {
  background: #f4f4f5;
  color: #27272a;
}

/* Tabela Estilo Excel/Sheet Pivot */
.sheet-table-wrapper {
  width: 100%;
  overflow-x: auto;
}

.sheet-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-sans);
  font-size: 13px;
  letter-spacing: 0.01em;
}

.sheet-table tr {
  height: 32px;
}

.sheet-table th {
  background: #404040;
  color: #ffffff;
  font-weight: 700;
  padding: 0 1.25rem;
  height: 32px;
  line-height: 32px;
  vertical-align: middle;
  border-bottom: 1px solid #525252;
  font-size: 13px;
  letter-spacing: 0.01em;
}

.sheet-table td {
  padding: 0 1.25rem;
  height: 32px;
  line-height: 32px;
  vertical-align: middle;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 13px;
  letter-spacing: 0.01em;
}

body.light-theme .sheet-table td {
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

/* Linha de Categoria (Subtotal) */
.sheet-row-category {
  background: #52525b !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s ease;
  height: 32px;
}

.sheet-row-category td {
  height: 32px;
  line-height: 32px;
  vertical-align: middle;
  font-size: 13px;
  letter-spacing: 0.01em;
}

.sheet-row-category:hover {
  background: #3f3f46 !important;
}

.sheet-category-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.sheet-category-icon {
  font-size: 0.75rem;
  transition: transform 0.2s ease;
}

.sheet-category-val {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

/* Linha de Item do Produto */
.sheet-row-item {
  background: rgba(255, 255, 255, 0.02);
  height: 32px;
}

body.light-theme .sheet-row-item {
  background: rgba(0, 0, 0, 0.01);
}

.sheet-item-indent {
  padding-left: 2.25rem !important;
  color: var(--text-primary);
  font-weight: 400;
  font-size: 13px;
  letter-spacing: 0.01em;
}

.sheet-item-val {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.01em;
}

/* Linha de Total Geral no Rodapé */
.sheet-row-total {
  background: #27272a !important;
  color: #ffffff !important;
  font-weight: 800 !important;
  font-size: 13px;
  letter-spacing: 0.01em;
  height: 32px;
}

body.light-theme .sheet-row-total {
  background: #3f3f46 !important;
}

.sheet-row-total td {
  padding: 0 1.25rem;
  height: 32px;
  line-height: 32px;
  vertical-align: middle;
  border-top: 2px solid #52525c;
  font-size: 13px;
  letter-spacing: 0.01em;
}

.sheet-total-val {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.01em;
}

/* Footer */
.app-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Badges de Status / Classificação */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  line-height: 1.2;
}

.badge-status-warning {
  background: var(--status-pending-bg);
  color: var(--status-pending-color);
  border-color: var(--status-pending-border);
}

.badge-status-info {
  background: var(--status-loading-bg);
  color: var(--status-loading-color);
  border-color: var(--status-loading-border);
}

.badge-status-success {
  background: var(--status-success-bg);
  color: var(--status-success-color);
  border-color: var(--status-success-border);
}

/* Animations */
.animate-fade-in {
  animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

