/* ==========================================================================
   GOOGLE WORKSPACE BACKUP AGENT — PAINEL OPERACIONAL
   Identidade Visual Institucional Grupo Luck (Manual GPL)
   Paleta: #027A6C (Verde Institucional), #73B446 (Verde Folha), 
           #E20613 (Vermelho Luck), #F2E1C0 (Bege Areia), #F9FBF8 (Off-White)
   Tipografia: Família Gotham (Títulos Gotham Black, Corpo Gotham Book via Montserrat)
   Suporte a Temas: Dark Mode (Padrão) & Light Mode com Seletor Sol/Lua
   ========================================================================== */

:root,
[data-theme="dark"] {
  /* Cores Primárias do Manual GPL */
  --luck-green-primary: #027A6C;       /* Verde Luck Institucional */
  --luck-green-light: #73B446;         /* Verde Folha / Sucesso e Destaque */
  --luck-red: #E20613;                 /* Vermelho Luck Institucional */
  --luck-sand: #F2E1C0;                /* Bege / Areia Suave */
  --luck-offwhite: #F9FBF8;            /* Branco Gelo / Off-White */

  /* Estrutura Dark Mode Sofisticada (Harmonizada com a Paleta Luck) */
  --bg-main: #06110F;                  /* Fundo Geral Noturno Esmeralda */
  --bg-card: #0B1917;                  /* Superfície dos Cards */
  --bg-card-hover: #102421;            /* Elevação Suave no Hover */
  --bg-table-stripe: #081412;          /* Fundo Alternado */
  --bg-input: #081513;                 /* Inputs e Seletores */
  
  --border-subtle: rgba(242, 225, 192, 0.12); /* Contornos com toque suave Areia */
  --border-brand: rgba(2, 122, 108, 0.35);    /* Contorno Verde Institucional */
  --border-focus: #73B446;                    /* Foco Verde Vibrante */

  /* Hierarquia Tipográfica e Textos */
  --text-primary: #F9FBF8;             /* Branco Off-White oficial */
  --text-secondary: #CBD9D6;           /* Leitura confortável institucional */
  --text-muted: #7E9792;               /* Informações secundárias e rótulos */
  --text-sand: #F2E1C0;                /* Destaque Areia Clássica */

  /* Badges e Acentos Legados */
  --accent-cyan: #73B446;
  --accent-blue: #027A6C;
  --accent-purple: #F2E1C0;
  --accent-emerald: #73B446;
  --accent-amber: #F59E0B;
  --accent-rose: #E20613;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(2, 122, 108, 0.15);
  --shadow-glow: 0 0 25px -5px rgba(2, 122, 108, 0.45);
  --shadow-glow-leaf: 0 0 25px -5px rgba(115, 180, 70, 0.35);

  --font-sans: 'Montserrat', 'Gotham', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

/* =========================================
   LIGHT MODE (Manual GPL Off-White #F9FBF8)
   ========================================= */
[data-theme="light"] {
  --bg-main: #F4F7F5;                  /* Fundo Geral Off-White descansado */
  --bg-card: #FFFFFF;                  /* Cards Brancos Puros */
  --bg-card-hover: #ECF4F0;            /* Elevação Suave no Hover */
  --bg-table-stripe: #F9FBF9;          /* Fundo Alternado */
  --bg-input: #FFFFFF;                 /* Inputs e Seletores */
  
  --border-subtle: rgba(2, 122, 108, 0.14); /* Contornos Esmeralda Sutis */
  --border-brand: rgba(2, 122, 108, 0.22);  /* Divisórias Marcadas */
  --border-focus: #027A6C;                  /* Foco no Verde Institucional */

  --text-primary: #041814;             /* Verde-musgo quase preto de altíssima legibilidade */
  --text-secondary: #2C4742;           /* Leitura institucional confortável */
  --text-muted: #56756F;               /* Informações secundárias e rótulos */
  --text-sand: #785208;                /* Areia escurecida p/ contraste no claro */

  --shadow-card: 0 4px 20px -2px rgba(2, 122, 108, 0.08), 0 0 0 1px rgba(2, 122, 108, 0.12);
  --shadow-glow: 0 0 25px -5px rgba(2, 122, 108, 0.2);
  --shadow-glow-leaf: 0 0 25px -5px rgba(115, 180, 70, 0.25);
}

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

html {
  overflow-x: clip;
  scroll-behavior: smooth;
}

body {
  overflow-x: clip;
  max-width: 100vw;
  background-color: var(--bg-main);
  color: var(--text-primary);
  font-family: var(--font-sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* =========================================
   HEADER & NAVIGATION
   ========================================= */
.app-header {
  background: rgba(6, 17, 15, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-brand);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
  transition: background-color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

[data-theme="light"] .app-header {
  background: rgba(255, 255, 255, 0.96);
  border-bottom-color: rgba(2, 122, 108, 0.18);
  box-shadow: 0 4px 18px rgba(2, 122, 108, 0.08);
}

.header-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0.85rem 2rem 0.65rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.brand-logo,
.brand-icon {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-md);
  background: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  box-shadow: 0 0 18px rgba(115, 180, 70, 0.35), 0 2px 8px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  flex-shrink: 0;
}

[data-theme="light"] .brand-logo,
[data-theme="light"] .brand-icon {
  border: 1px solid rgba(2, 122, 108, 0.18);
  box-shadow: 0 2px 10px rgba(2, 122, 108, 0.12);
}

.brand-logo:hover,
.brand-icon:hover {
  transform: scale(1.05);
  box-shadow: 0 0 24px rgba(115, 180, 70, 0.5);
}

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

.brand-icon svg {
  width: 24px;
  height: 24px;
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 800; /* Gotham Black */
  letter-spacing: -0.02em;
  background: linear-gradient(to right, #F9FBF8 40%, var(--luck-sand) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.2;
  margin: 0;
}

[data-theme="light"] .brand-title {
  background: linear-gradient(to right, #027A6C 30%, #039685 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

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

/* =========================================
   SELETOR GLOBAL DE BASE OPERACIONAL
   ========================================= */
.base-filter-wrapper {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(8, 20, 18, 0.7);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0 0.6rem;
  height: 38px;
  transition: all 0.2s ease;
}

[data-theme="light"] .base-filter-wrapper {
  background: #FFFFFF;
  border-color: rgba(2, 122, 108, 0.25);
  box-shadow: 0 1px 4px rgba(2, 122, 108, 0.08);
}

.base-filter-wrapper:hover,
.base-filter-wrapper:focus-within {
  border-color: var(--luck-green-light);
  box-shadow: 0 0 10px rgba(115, 180, 70, 0.25);
}

[data-theme="light"] .base-filter-wrapper:hover,
[data-theme="light"] .base-filter-wrapper:focus-within {
  border-color: var(--luck-green-primary);
  box-shadow: 0 0 8px rgba(2, 122, 108, 0.15);
}

.base-icon {
  width: 16px;
  height: 16px;
  color: var(--luck-green-light);
  flex-shrink: 0;
}

[data-theme="light"] .base-icon {
  color: var(--luck-green-primary);
}

.select-base {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.825rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.25rem 0.35rem;
  min-width: 155px;
}

[data-theme="light"] .select-base {
  color: #041814;
}

.select-base option {
  background: var(--bg-card);
  color: var(--text-primary);
}

[data-theme="light"] .select-base option {
  background: #FFFFFF;
  color: #041814;
}

/* Barra de Armazenamento por Base */
.storage-cell {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 180px;
}

.storage-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.775rem;
  color: var(--text-muted);
}

.storage-progress {
  width: 100%;
  height: 6px;
  background: rgba(242, 225, 192, 0.1);
  border-radius: 9999px;
  overflow: hidden;
}

[data-theme="light"] .storage-progress {
  background: rgba(2, 122, 108, 0.1);
}

.storage-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--luck-green-primary), var(--luck-green-light));
  border-radius: 9999px;
  transition: width 0.4s ease;
}

/* =========================================
   BOTÃO DE TEMA DISCRETO (SOL / LUA)
   ========================================= */
.btn-theme {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: rgba(242, 225, 192, 0.08);
  border: 1px solid var(--border-subtle);
  color: var(--luck-sand);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-theme:hover {
  background: rgba(242, 225, 192, 0.18);
  border-color: var(--border-focus);
  transform: scale(1.06);
  color: var(--luck-green-light);
}

.theme-icon {
  width: 19px;
  height: 19px;
  transition: transform 0.3s ease;
}

.btn-theme:hover .theme-icon {
  transform: rotate(18deg);
}

/* Modo Dark: exibe ícone de LUA */
:root .icon-sun,
[data-theme="dark"] .icon-sun {
  display: none;
}

:root .icon-moon,
[data-theme="dark"] .icon-moon {
  display: block;
}

/* Modo Light: exibe ícone de SOL */
[data-theme="light"] .icon-moon {
  display: none;
}

[data-theme="light"] .icon-sun {
  display: block;
  color: #D98200; /* Sol dourado acolhedor */
}

[data-theme="light"] .btn-theme {
  background: #FFFFFF;
  border: 1px solid rgba(2, 122, 108, 0.25);
  color: #D98200;
  box-shadow: 0 1px 4px rgba(2, 122, 108, 0.08);
}

[data-theme="light"] .btn-theme:hover {
  background: #FFFBF2;
  border-color: #D98200;
  box-shadow: 0 2px 8px rgba(217, 130, 0, 0.25);
}

/* =========================================
   NAVIGATION TABS
   ========================================= */
.nav-tabs {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  gap: 0.5rem;
}

.nav-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.85rem 1.15rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  position: relative;
  transition: all 0.2s ease;
}

.nav-tab svg {
  width: 18px;
  height: 18px;
}

.nav-tab:hover {
  color: var(--text-primary);
}

.nav-tab.active {
  color: var(--luck-green-light);
}

[data-theme="light"] .nav-tab {
  color: var(--text-muted);
}

[data-theme="light"] .nav-tab:hover {
  color: var(--luck-green-primary);
}

[data-theme="light"] .nav-tab.active {
  color: var(--luck-green-primary);
}

.nav-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--luck-green-light);
  box-shadow: 0 0 12px var(--luck-green-light);
}

[data-theme="light"] .nav-tab.active::after {
  background: var(--luck-green-primary);
  box-shadow: 0 0 10px rgba(2, 122, 108, 0.4);
}

/* =========================================
   CONTAINER & LAYOUT
   ========================================= */
.main-container {
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 1.25rem 1.25rem;
  flex: 1;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
  animation: fadeIn 0.3s ease-out;
}

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

/* =========================================
   KPI CARDS GRID (6 Cards em Linha Única)
   ========================================= */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.85rem;
  margin-bottom: 2rem;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-brand);
  border-radius: var(--radius-lg);
  padding: 1rem 1.15rem;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--luck-green-primary), var(--luck-green-light));
  opacity: 0.8;
}

.kpi-card:hover {
  transform: translateY(-2px);
  border-color: rgba(115, 180, 70, 0.4);
  box-shadow: 0 6px 24px -2px rgba(0, 0, 0, 0.6), 0 0 15px rgba(2, 122, 108, 0.25);
}

[data-theme="light"] .kpi-card:hover {
  box-shadow: 0 8px 24px -2px rgba(2, 122, 108, 0.15), 0 0 12px rgba(2, 122, 108, 0.1);
  border-color: rgba(2, 122, 108, 0.35);
}

.kpi-header {
  display: block;
  margin-bottom: 0.4rem;
}

.kpi-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  white-space: normal;
  line-height: 1.25;
  min-height: 1.85rem;
  display: flex;
  align-items: center;
}

.kpi-value {
  font-size: 1.85rem;
  font-weight: 800; /* Gotham Black */
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-footer {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: normal;
  line-height: 1.25;
  margin-top: 0.2rem;
}

/* =========================================
   CARDS & GRIDS
   ========================================= */
.grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 900px) {
  .grid-2col { grid-template-columns: 1fr; }
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-brand);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  margin-bottom: 1.5rem;
  overflow: hidden;
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-brand);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(8, 20, 18, 0.5);
  transition: background-color 0.25s ease;
}

[data-theme="light"] .card-header {
  background: #FAFCFA;
  border-bottom-color: rgba(2, 122, 108, 0.14);
}

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.card-desc {
  font-size: 0.825rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.card-body {
  padding: 1.5rem;
}

.card-body.no-padding {
  padding: 0;
}

/* =========================================
   TABLES
   ========================================= */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
}

.table-responsive::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.815rem;
}

.data-table th {
  background: rgba(8, 20, 18, 0.85);
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  padding: 0.7rem 0.65rem;
  border-bottom: 1px solid var(--border-brand);
  white-space: nowrap;
}

[data-theme="light"] .data-table th {
  background: #EDF4F1;
  color: #385953;
  border-bottom-color: rgba(2, 122, 108, 0.22);
}

.data-table td {
  padding: 0.7rem 0.65rem;
  border-bottom: 1px solid rgba(242, 225, 192, 0.05);
  color: var(--text-secondary);
  vertical-align: middle;
  white-space: nowrap;
}

[data-theme="light"] .data-table td {
  border-bottom-color: rgba(2, 122, 108, 0.08);
}

.data-table tbody tr {
  transition: background-color 0.15s ease;
}

.data-table tbody tr:hover {
  background-color: var(--bg-card-hover);
}

[data-theme="light"] .data-table tbody tr:hover {
  background-color: #ECF5F1;
}

/* =========================================
   BADGES & BUTTONS (Identidade Grupo Luck)
   ========================================= */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Sucesso com Verde Folha Institucional */
.badge-success { 
  background: rgba(115, 180, 70, 0.18); 
  color: var(--luck-green-light); 
  border: 1px solid rgba(115, 180, 70, 0.35); 
}

[data-theme="light"] .badge-success {
  background: rgba(115, 180, 70, 0.15);
  color: #3B721A;
  border-color: rgba(115, 180, 70, 0.4);
}

/* Atenção / Parcial */
.badge-warning { 
  background: rgba(245, 158, 11, 0.16); 
  color: #FBBF24; 
  border: 1px solid rgba(245, 158, 11, 0.35); 
}

[data-theme="light"] .badge-warning {
  background: rgba(245, 158, 11, 0.12);
  color: #B45309;
  border-color: rgba(245, 158, 11, 0.3);
}

/* Falha com Vermelho Luck Oficial */
.badge-danger  { 
  background: rgba(226, 6, 19, 0.18);  
  color: #FF5A66;  
  border: 1px solid rgba(226, 6, 19, 0.4); 
}

[data-theme="light"] .badge-danger {
  background: rgba(226, 6, 19, 0.1);
  color: #C20510;
  border-color: rgba(226, 6, 19, 0.3);
}

/* Verde Luck Primário / Full Run */
.badge-purple,
.badge-green { 
  background: rgba(2, 122, 108, 0.25); 
  color: #38DFCA; 
  border: 1px solid rgba(2, 122, 108, 0.45); 
}

[data-theme="light"] .badge-purple,
[data-theme="light"] .badge-green {
  background: rgba(2, 122, 108, 0.12);
  color: #027A6C;
  border-color: rgba(2, 122, 108, 0.35);
}

/* Bege / Areia Oficial (Para contas e tokens) */
.badge-sand { 
  background: rgba(242, 225, 192, 0.16); 
  color: var(--luck-sand); 
  border: 1px solid rgba(242, 225, 192, 0.35); 
}

[data-theme="light"] .badge-sand {
  background: #FDF9EE;
  color: #8A681E;
  border-color: #E8D9B4;
}

.badge-blue,
.badge-cyan { 
  background: rgba(115, 180, 70, 0.18); 
  color: var(--luck-green-light); 
  border: 1px solid rgba(115, 180, 70, 0.35); 
}

/* Botões */
.btn {
  background: linear-gradient(135deg, var(--luck-green-primary), #039685);
  color: #F9FBF8;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.5rem 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(2, 122, 108, 0.35);
}

.btn:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(115, 180, 70, 0.4);
}

.btn-secondary {
  background: rgba(242, 225, 192, 0.06);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  box-shadow: none;
}

[data-theme="light"] .btn-secondary {
  background: #FFFFFF;
  border: 1px solid rgba(2, 122, 108, 0.25);
  color: #041814;
}

.btn-secondary:hover {
  background: rgba(242, 225, 192, 0.12);
  border-color: rgba(242, 225, 192, 0.25);
  box-shadow: none;
}

[data-theme="light"] .btn-secondary:hover {
  background: #F0F6F3;
  border-color: rgba(2, 122, 108, 0.4);
}

.btn-link {
  background: transparent;
  border: none;
  color: var(--luck-green-light);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

[data-theme="light"] .btn-link {
  color: var(--luck-green-primary);
}

.btn-link:hover { text-decoration: underline; color: #88CF56; }
[data-theme="light"] .btn-link:hover { color: #02594F; }

.icon {
  width: 16px;
  height: 16px;
}

.code-font {
  font-family: var(--font-mono);
  font-size: 0.825rem;
}

.text-accent { color: var(--luck-green-light); font-weight: 600; }
[data-theme="light"] .text-accent { color: var(--luck-green-primary); }

.text-success { color: var(--luck-green-light); font-weight: 600; }
[data-theme="light"] .text-success { color: #3B721A; }

.text-warning { color: var(--accent-amber); font-weight: 600; }
.text-sand { color: var(--text-sand); font-weight: 600; }
[data-theme="light"] .text-sand { color: #785208; }

.org-unit-code {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-sand);
  font-weight: 500;
}

[data-theme="light"] .org-unit-code {
  color: #785208;
  font-weight: 600;
}

/* =========================================
   TOOLBAR DE FILTROS ALINHADA (COFRE DE ARQUIVOS)
   ========================================= */
.filter-toolbar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 1.25rem;
  background: rgba(8, 20, 18, 0.45);
  border-bottom: 1px solid var(--border-brand);
  flex-wrap: nowrap;
  overflow-x: hidden;
  width: 100%;
}

[data-theme="light"] .filter-toolbar {
  background: #FAFCFA;
  border-bottom-color: rgba(2, 122, 108, 0.14);
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.filter-group.search-group {
  flex: 1.2;
  min-width: 170px;
  position: relative;
  flex-shrink: 1;
}

.filter-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

.filter-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.search-input {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 0.35rem 0.75rem 0.35rem 2.1rem;
  font-size: 0.8rem;
  font-family: var(--font-sans);
  outline: none;
  width: 100%;
  height: 35px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

[data-theme="light"] .search-input {
  background: #FFFFFF;
  border: 1px solid rgba(2, 122, 108, 0.25);
  color: #041814;
}

.search-input:focus { 
  border-color: var(--border-focus); 
  box-shadow: 0 0 0 2px rgba(115, 180, 70, 0.2); 
}

[data-theme="light"] .search-input:focus {
  border-color: var(--luck-green-primary);
  box-shadow: 0 0 0 2px rgba(2, 122, 108, 0.15);
}

.select-filter {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
  font-family: var(--font-sans);
  outline: none;
  height: 35px;
  cursor: pointer;
  transition: border-color 0.2s;
}

[data-theme="light"] .select-filter {
  background: #FFFFFF;
  border: 1px solid rgba(2, 122, 108, 0.25);
  color: #041814;
}

.select-filter:focus {
  border-color: var(--border-focus);
}

.btn-reset {
  height: 35px;
  padding: 0 0.85rem;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
}

/* Health List */
.health-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.health-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(242, 225, 192, 0.06);
}

[data-theme="light"] .health-item {
  border-bottom-color: rgba(2, 122, 108, 0.08);
}

.health-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.health-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.health-value {
  font-size: 0.875rem;
  color: var(--text-primary);
}

/* Recent Runs Timeline */
.recent-runs-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.recent-run-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1rem;
  background: rgba(8, 20, 18, 0.6);
  border: 1px solid var(--border-brand);
  border-radius: var(--radius-md);
  transition: background 0.15s, border-color 0.15s;
}

[data-theme="light"] .recent-run-item {
  background: #F9FBFA;
  border-color: rgba(2, 122, 108, 0.18);
}

.recent-run-item:hover {
  background: var(--bg-card-hover);
  border-color: rgba(115, 180, 70, 0.35);
}

[data-theme="light"] .recent-run-item:hover {
  background: #EEF5F1;
  border-color: rgba(2, 122, 108, 0.35);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-backdrop.hidden {
  display: none;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-brand);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 680px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.7);
}

[data-theme="light"] .modal-content {
  background: #FFFFFF;
  border-color: rgba(2, 122, 108, 0.25);
  box-shadow: 0 20px 45px rgba(2, 122, 108, 0.18);
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-brand);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(8, 20, 18, 0.6);
}

[data-theme="light"] .modal-header {
  background: #F8FAF8;
  border-bottom-color: rgba(2, 122, 108, 0.15);
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  transition: color 0.15s;
}

.modal-close:hover {
  color: var(--luck-red);
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
}

.json-viewer {
  background: #040A09;
  padding: 1rem;
  border-radius: var(--radius-sm);
  color: #38DFCA;
  font-family: var(--font-mono);
  font-size: 0.825rem;
  white-space: pre-wrap;
  word-break: break-all;
  border: 1px solid rgba(2, 122, 108, 0.2);
}

[data-theme="light"] .json-viewer {
  background: #F3F8F5;
  color: #027A6C;
  border: 1px solid rgba(2, 122, 108, 0.2);
}

/* Status de Reconciliação e Erros no Modal */
.error-resolution-banner {
  padding: 0.9rem 1.25rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.25rem;
  font-size: 0.85rem;
  line-height: 1.45;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.error-resolution-banner.success {
  background: rgba(115, 180, 70, 0.14);
  border: 1px solid rgba(115, 180, 70, 0.4);
  color: #C1F0A4;
}

[data-theme="light"] .error-resolution-banner.success {
  background: rgba(115, 180, 70, 0.12);
  border-color: rgba(115, 180, 70, 0.4);
  color: #2F6313;
}

.error-resolution-banner.warning {
  background: rgba(245, 158, 11, 0.14);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #FDE68A;
}

[data-theme="light"] .error-resolution-banner.warning {
  background: rgba(245, 158, 11, 0.1);
  color: #92400E;
}

.error-resolution-banner.neutral {
  background: rgba(2, 122, 108, 0.14);
  border: 1px solid rgba(2, 122, 108, 0.35);
  color: #A7F3D0;
}

[data-theme="light"] .error-resolution-banner.neutral {
  background: rgba(2, 122, 108, 0.1);
  color: #027A6C;
}

.modal-failed-box {
  background: rgba(8, 20, 18, 0.7);
  border: 1px solid var(--border-brand);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-bottom: 1.25rem;
}

[data-theme="light"] .modal-failed-box {
  background: #F8FAF8;
  border-color: rgba(2, 122, 108, 0.2);
}

.modal-failed-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-failed-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.modal-failed-table th {
  background: rgba(255, 255, 255, 0.04);
  padding: 0.5rem 0.65rem;
  text-align: left;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border-brand);
}

[data-theme="light"] .modal-failed-table th {
  background: #EDF4F1;
  color: #385953;
  border-bottom-color: rgba(2, 122, 108, 0.2);
}

.modal-failed-table td {
  padding: 0.6rem 0.65rem;
  border-bottom: 1px solid rgba(242, 225, 192, 0.06);
  vertical-align: top;
}

[data-theme="light"] .modal-failed-table td {
  border-bottom-color: rgba(2, 122, 108, 0.08);
}

.badge-resolved {
  background: rgba(115, 180, 70, 0.2);
  color: var(--luck-green-light);
  border: 1px solid rgba(115, 180, 70, 0.4);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

[data-theme="light"] .badge-resolved {
  background: rgba(115, 180, 70, 0.15);
  color: #3B721A;
}

.badge-pending {
  background: rgba(226, 6, 19, 0.2);
  color: #FF5A66;
  border: 1px solid rgba(226, 6, 19, 0.4);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

[data-theme="light"] .badge-pending {
  background: rgba(226, 6, 19, 0.1);
  color: #C20510;
}

/* =========================================
   PAGINATION BAR
   ========================================= */
.pagination-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1.25rem;
  background: rgba(8, 20, 18, 0.85);
  border-top: 1px solid var(--border-brand);
  font-size: 0.825rem;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 1rem;
}

[data-theme="light"] .pagination-bar {
  background: #F4F8F6;
  border-top-color: rgba(2, 122, 108, 0.18);
}

.pagination-info {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.rows-selector {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.rows-selector select {
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
}

[data-theme="light"] .rows-selector select {
  background: #FFFFFF;
  border-color: rgba(2, 122, 108, 0.25);
  color: #041814;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-page {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

.btn-page:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.page-indicator {
  font-weight: 700;
  color: var(--luck-sand);
  min-width: 90px;
  text-align: center;
}

[data-theme="light"] .page-indicator {
  color: var(--luck-green-primary);
}

/* Footer */
.app-footer {
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-brand);
}

[data-theme="light"] .app-footer {
  border-top-color: rgba(2, 122, 108, 0.18);
  background: #F4F7F5;
}

/* ==========================================================================
   MODAL COMPONENT & GMAIL RESTORE INTERFACE
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 1.5rem;
  transition: opacity 0.2s ease;
}

.modal-backdrop.hidden {
  display: none;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-brand);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  display: flex;
  flex-direction: column;
}

.modal-content.modal-lg {
  max-width: 720px;
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.25rem;
  transition: color 0.15s ease;
}

.modal-close:hover {
  color: var(--luck-red);
}

.modal-body {
  padding: 1.5rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

.form-control {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: border-color 0.2s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--luck-green-light);
}

/* Radio Cards Grid */
.radio-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.radio-card {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--bg-input);
  position: relative;
}

.radio-card input[type="radio"] {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  accent-color: var(--luck-green-light);
}

.radio-card-content strong {
  display: block;
  font-size: 0.9rem;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.radio-card-content span {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.radio-card:hover {
  border-color: var(--border-brand);
  background: var(--bg-card-hover);
}

.radio-card:has(input:checked) {
  border-color: var(--luck-green-light);
  background: rgba(115, 180, 70, 0.08);
}

/* Etiqueta Visual de TI */
.badge-ti-tag {
  display: inline-block;
  background: #16a765;
  color: #ffffff;
  font-weight: 700;
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  letter-spacing: 0.3px;
  vertical-align: middle;
}

.icon-emerald {
  color: var(--luck-green-light);
  background: rgba(115, 180, 70, 0.12);
}

/* Feedback Box */
.restore-feedback {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  line-height: 1.4;
}

.restore-feedback.success {
  background: rgba(115, 180, 70, 0.15);
  border: 1px solid var(--luck-green-light);
  color: var(--luck-green-light);
}

.restore-feedback.error {
  background: rgba(226, 6, 19, 0.15);
  border: 1px solid var(--luck-red);
  color: #ff6b72;
}

.restore-feedback.loading {
  background: rgba(2, 122, 108, 0.15);
  border: 1px solid var(--luck-green-primary);
  color: var(--luck-sand);
}
