/* Clean Executive Theme Variables */
:root {
  --bg-main: #f1f5f9;
  --bg-card: #ffffff;
  --bg-input: #ffffff;
  --bg-table-header: #e2e8f0;
  --bg-bold-row: rgba(8, 145, 178, 0.05);
  --border-color: #cbd5e1;
  --text-main: #0f172a;
  --text-muted: #334155;
  --accent-cyan: #0891b2;
  --accent-purple: #6d28d9;
  --success: #059669;
  --danger: #dc2626;
  --warning: #d97706;
  --font-family: 'Outfit', sans-serif;
  --transition-fast: 0.2s ease;
  --transition-smooth: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  --shadow-premium: 0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.08);
}

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

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-family);
  min-height: 100vh;
  padding: 2rem;
  overflow-y: auto;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Containers & Layouts */
.dashboard-container {
  max-width: 96%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Cards (Glassmorphism) */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  box-shadow: var(--shadow-premium);
  padding: 1.5rem;
}

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

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

.logo-circle {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  color: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.25rem;
  box-shadow: 0 4px 15px rgba(0, 242, 254, 0.35);
}

.brand-info h1 {
  font-size: 1.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--text-main), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-info .subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.update-badge {
  font-size: 0.8rem;
  background: rgba(0, 242, 254, 0.08);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 242, 254, 0.18);
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  font-weight: 600;
}

/* Top Controls Bar */
.controls-bar {
  display: flex;
  gap: 2rem;
  align-items: center;
  position: relative;
  z-index: 2000;
}

.control-item {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.control-item label {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.05em;
}

.multiselect-dropdown {
  position: relative;
  min-width: 220px;
  font-size: 0.9rem;
}

.select-box {
  background: var(--bg-input);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 0.6rem 1rem;
  border-radius: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-weight: 600;
  transition: var(--transition-fast);
  user-select: none;
}

.select-box:hover {
  border-color: rgba(8, 145, 178, 0.5);
}

.select-box .arrow {
  font-size: 0.75rem;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.multiselect-dropdown.active .select-box {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(8, 145, 178, 0.15);
}

.multiselect-dropdown.active .arrow {
  transform: rotate(180deg);
}

.options-container {
  position: absolute;
  top: 108%;
  left: 0;
  right: 0;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  max-height: 250px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.15);
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.options-container.hidden {
  display: none;
}

.option-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.65rem;
  cursor: pointer;
  border-radius: 8px;
  color: var(--text-main);
  font-weight: 500;
  transition: var(--transition-fast);
  user-select: none;
}

.option-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.option-item.selected {
  background: rgba(0, 242, 254, 0.06);
  color: var(--accent-cyan);
}

.option-item input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent-cyan);
  cursor: pointer;
}

.option-item label {
  cursor: pointer;
  flex: 1;
  text-transform: none !important;
  font-size: 0.85rem !important;
  font-weight: 500 !important;
  color: inherit !important;
  letter-spacing: normal !important;
  margin: 0;
}


/* KPI Summary Cards */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  box-shadow: var(--shadow-premium);
}

.kpi-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.kpi-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-main);
}

.kpi-trend {
  font-size: 0.8rem;
  font-weight: 600;
}

/* Table Section styles */
.dashboard-body {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.table-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.table-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem;
}

.table-icon {
  font-size: 1.25rem;
}

.table-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
}

.table-wrapper {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
}

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

.executive-table th {
  background: var(--bg-table-header);
  border-bottom: 2px solid var(--border-color);
  padding: 0.75rem 1rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: right;
  white-space: nowrap;
}

.executive-table th:first-child {
  text-align: left;
}

.executive-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  text-align: right;
  vertical-align: middle;
  white-space: nowrap;
}

.executive-table td:first-child {
  text-align: left;
  font-weight: 500;
}

.executive-table tbody tr {
  transition: var(--transition-fast);
}

.executive-table tbody tr:hover {
  background: rgba(15, 23, 42, 0.02);
}

/* Bold/Total rows */
.bold-row {
  font-weight: 700;
  background-color: var(--bg-bold-row);
}

.bold-row td {
  border-bottom: 1px solid var(--border-color) !important;
}

.bold-row td:first-child {
  font-weight: 700 !important;
  color: var(--accent-cyan);
}

/* Trend Indicators (Semáforos) */
.trend-container {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font-weight: 700;
}

.trend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.trend-dot.up {
  background-color: var(--success);
  box-shadow: 0 0 6px var(--success);
}
.trend-dot.down {
  background-color: var(--danger);
  box-shadow: 0 0 6px var(--danger);
}
.trend-dot.flat {
  background-color: var(--warning);
  box-shadow: 0 0 6px var(--warning);
}

.trend-pct.up {
  color: var(--success);
}
.trend-pct.down {
  color: var(--danger);
}
.trend-pct.flat {
  color: var(--warning);
}

/* Responsive Grid styling */
.tables-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

.tables-column {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

@media (max-width: 1024px) {
  .tables-grid {
    grid-template-columns: 1fr;
  }
  .kpi-row {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 768px) {
  .kpi-row {
    grid-template-columns: 1fr;
  }
  .controls-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }
}

/* Collapsible Pivot Rows */
.hidden-row {
  display: none !important;
}

.bold-row {
  cursor: pointer;
  user-select: none;
}

.bold-row:hover {
  background-color: rgba(255, 255, 255, 0.08) !important;
}

.toggle-icon {
  font-size: 0.65rem;
  margin-right: 0.5rem;
  display: inline-block;
  color: var(--accent-cyan);
}

