/* ===================== CUSTOM STYLES - GESTION HUB ===================== */
/* Purple/Pink Glassmorphism Theme */

:root {
  --bg-color: #13111C;
  --bg-dim: #13111C;
  --surface-color: #1E1B2E;
  --surface-high: #252236;
  --surface-highest: #332E4D;
  --text-color: #F8FAFC;
  --text-muted: #94A3B8;
  --outline-color: #94A3B8;
  --outline-variant: #332E4D;
  --primary: #8B5CF6;
  --primary-container: #7C3AED;
  --secondary: #EC4899;
  --success: #10B981;
  --error: #F43F5E;
  --tw-primary: #8B5CF6;
  --tw-primary-container: #7C3AED;
  --tw-secondary: #EC4899;
  --tw-secondary-container: #BE185D;
}

html.light {
  --bg-color: #F0F9F8;
  --bg-dim: #E6F5F3;
  --surface-color: #FFFFFF;
  --surface-high: #E8F8F5;
  --surface-highest: #D1F0E8;
  --text-color: #0F172A;
  --text-muted: #475569;
  --outline-color: #94A3B8;
  --outline-variant: #B2DFDB;
  --primary: #00A99D;
  --primary-container: #00897B;
  --secondary: #76E0C2;
  --secondary-container: #4DB6AC;
  --tw-primary: #00A99D;
  --tw-primary-container: #00897B;
  --tw-secondary: #76E0C2;
  --tw-secondary-container: #4DB6AC;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-color);
}

/* ===================== GLASS PANELS ===================== */
.glass-panel {
  background: rgba(30, 27, 46, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(139, 92, 246, 0.15);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

html.light .glass-panel {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(0, 169, 157, 0.2);
  box-shadow: 0 4px 24px rgba(0, 169, 157, 0.08);
}

/* ===================== SCROLLBARS ===================== */
.custom-scrollbar::-webkit-scrollbar { width: 5px; height: 5px; }
.custom-scrollbar::-webkit-scrollbar-track { background: transparent; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: #332E4D; border-radius: 4px; }
.custom-scrollbar::-webkit-scrollbar-thumb:hover { background: #8B5CF6; }

html.light .custom-scrollbar::-webkit-scrollbar-thumb { background: #B2DFDB; border-radius: 4px; }
html.light .custom-scrollbar::-webkit-scrollbar-thumb:hover { background: #00A99D; }

.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* ===================== PANEL HEADER ===================== */
.panel-title {
  font-size: clamp(0.7rem, 1vw, 0.9rem);
}

/* ===================== HIERARCHY TABLE ===================== */
.hierarchy-table {
  width: 100%;
  border-collapse: collapse;
  font-size: clamp(0.6rem, 0.85vw, 0.8rem);
}

.hierarchy-table th {
  padding: clamp(6px, 0.6vw, 10px) clamp(8px, 0.8vw, 14px);
  text-align: left;
  font-size: clamp(0.55rem, 0.7vw, 0.7rem);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 2px solid rgba(139, 92, 246, 0.3);
  position: sticky;
  top: 0;
  background: var(--surface-high);
  z-index: 5;
  white-space: nowrap;
}

html.light .hierarchy-table th {
  border-bottom-color: rgba(0, 169, 157, 0.25);
}

.hierarchy-table th.th-origen {
  min-width: clamp(150px, 20vw, 280px);
  width: 40%;
}

.hierarchy-table th.th-total {
  min-width: clamp(60px, 7vw, 100px);
  text-align: right;
  color: var(--primary);
}

.hierarchy-table td {
  padding: clamp(4px, 0.5vw, 8px) clamp(6px, 0.7vw, 14px);
  font-size: clamp(0.55rem, 0.8vw, 0.75rem);
  border-bottom: 1px solid rgba(51, 46, 77, 0.4);
  white-space: nowrap;
}

html.light .hierarchy-table td {
  border-bottom-color: rgba(71, 85, 105, 0.2);
}

.hierarchy-table tr:hover td {
  background: rgba(139, 92, 246, 0.06);
}

html.light .hierarchy-table tr:hover td {
  background: rgba(0, 169, 157, 0.06);
}

/* Parent rows */
.hierarchy-table .row-parent td {
  background: rgba(139, 92, 246, 0.06);
  border-bottom: 1px solid rgba(139, 92, 246, 0.15);
}

html.light .hierarchy-table .row-parent td {
  background: rgba(0, 169, 157, 0.05);
  border-bottom-color: rgba(0, 169, 157, 0.15);
}

.hierarchy-table .row-parent.row-expanded td {
  background: rgba(139, 92, 246, 0.1);
}

html.light .hierarchy-table .row-parent.row-expanded td {
  background: rgba(0, 169, 157, 0.08);
}

.hierarchy-table .row-parent:hover td {
  background: rgba(139, 92, 246, 0.14);
}

html.light .hierarchy-table .row-parent:hover td {
  background: rgba(0, 169, 157, 0.12);
}

.hierarchy-table .td-origen {
  min-width: clamp(150px, 20vw, 280px);
}

.hierarchy-table .parent-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  color: var(--text-color);
  cursor: pointer;
}

.hierarchy-table .parent-num {
  color: var(--text-muted);
  margin-right: 2px;
}

.hierarchy-table .parent-name {
  background: linear-gradient(135deg, #8B5CF6 0%, #EC4899 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

html.light .hierarchy-table .parent-name {
  background: linear-gradient(135deg, #00A99D 0%, #76E0C2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hierarchy-table .toggle-icon {
  font-size: clamp(12px, 1vw, 16px);
  color: var(--primary);
  cursor: pointer;
  transition: transform 0.2s, color 0.2s;
  flex-shrink: 0;
}

.hierarchy-table .toggle-icon:hover {
  color: #A78BFA;
}

html.light .hierarchy-table .toggle-icon:hover {
  color: #00897B;
}

/* Child rows */
.hierarchy-table .row-sub td {
  background: transparent;
  font-size: clamp(0.5rem, 0.75vw, 0.7rem);
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s;
}

.hierarchy-table .row-sub:hover td {
  background: rgba(139, 92, 246, 0.08);
}

html.light .hierarchy-table .row-sub:hover td {
  background: rgba(0, 169, 157, 0.06);
}

.hierarchy-table .row-sub.row-selected td {
  background: rgba(139, 92, 246, 0.15);
  border-bottom-color: rgba(139, 92, 246, 0.3);
}

html.light .hierarchy-table .row-sub.row-selected td {
  background: rgba(0, 169, 157, 0.1);
  border-bottom-color: rgba(0, 169, 157, 0.2);
}

.hierarchy-table .child-label {
  display: flex;
  align-items: center;
  gap: 4px;
}

.hierarchy-table .child-indent {
  display: inline-block;
  width: clamp(10px, 1.2vw, 20px);
}

.hierarchy-table .child-icon {
  font-size: clamp(10px, 0.9vw, 14px);
  color: var(--text-muted);
}

.hierarchy-table .td-total-parent {
  font-weight: 700;
  color: var(--primary);
}

.hierarchy-table .td-total-child {
  color: var(--text-color);
  font-weight: 500;
}

/* Grand total row */
.hierarchy-table .row-grand-total td {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.12) 0%, rgba(236, 72, 153, 0.08) 100%);
  border-top: 2px solid rgba(139, 92, 246, 0.4);
  font-weight: 700;
  color: var(--text-color);
}

html.light .hierarchy-table .row-grand-total td {
  background: linear-gradient(135deg, rgba(0, 169, 157, 0.1) 0%, rgba(118, 224, 194, 0.06) 100%);
  border-top-color: rgba(0, 169, 157, 0.3);
}

.hierarchy-table .td-total-grand {
  background: linear-gradient(135deg, #8B5CF6 0%, #EC4899 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-size: clamp(0.6rem, 0.85vw, 0.8rem);
}

html.light .hierarchy-table .td-total-grand {
  background: linear-gradient(135deg, #00A99D 0%, #76E0C2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ===================== DATA TABLE ===================== */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: clamp(0.7rem, 0.9vw, 0.85rem);
}

.data-table thead {
  background: var(--surface-high);
  position: sticky;
  top: 0;
  z-index: 2;
}

.data-table th {
  padding: clamp(8px, 0.8vw, 14px) clamp(8px, 0.9vw, 14px);
  text-align: left;
  font-weight: 600;
  font-size: clamp(0.65rem, 0.8vw, 0.75rem);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 2px solid rgba(139, 92, 246, 0.3);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  transition: background 0.15s, color 0.15s;
}

html.light .data-table th {
  border-bottom-color: rgba(0, 169, 157, 0.25);
}

.data-table th:hover {
  background: rgba(139, 92, 246, 0.1);
  color: var(--primary);
}

html.light .data-table th:hover {
  background: rgba(0, 169, 157, 0.08);
}

.data-table td {
  padding: clamp(6px, 0.6vw, 10px) clamp(6px, 0.7vw, 14px);
  border-bottom: 1px solid rgba(51, 46, 77, 0.3);
  color: var(--text-color);
  max-width: clamp(150px, 20vw, 300px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html.light .data-table td {
  border-bottom-color: rgba(71, 85, 105, 0.15);
}

.data-table tr:hover td {
  background: rgba(139, 92, 246, 0.05);
}

html.light .data-table tr:hover td {
  background: rgba(0, 169, 157, 0.04);
}

.text-right { text-align: right; }
.text-primary { color: var(--primary) !important; }
.font-mono { font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace; font-size: clamp(0.65rem, 0.8vw, 0.75rem); }

/* ===================== PAGINATION ===================== */
.pagination {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-top: 10px;
  padding: 8px;
  flex-wrap: wrap;
}

.pagination button {
  padding: 4px 10px;
  border: 1px solid rgba(139, 92, 246, 0.3);
  background: transparent;
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  font-size: clamp(0.5rem, 0.7vw, 0.7rem);
  transition: all 0.2s;
}

html.light .pagination button {
  border-color: rgba(0, 169, 157, 0.25);
}

.pagination button:hover {
  background: rgba(139, 92, 246, 0.1);
  color: var(--primary);
  border-color: var(--primary);
}

html.light .pagination button:hover {
  background: rgba(0, 169, 157, 0.08);
  color: #00897B;
  border-color: #00A99D;
}

.pagination button.active {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.3) 0%, rgba(236, 72, 153, 0.2) 100%);
  color: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.3);
}

html.light .pagination button.active {
  background: linear-gradient(135deg, rgba(0, 169, 157, 0.2) 0%, rgba(118, 224, 194, 0.12) 100%);
  color: #00897B;
  border-color: #00A99D;
  box-shadow: 0 0 12px rgba(0, 169, 157, 0.2);
}

.pagination button:disabled { opacity: 0.3; cursor: not-allowed; }

/* ===================== SPINNER ===================== */
.spinner { display: none; }
.spinner::after {
  content: 'Cargando...';
  animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* ===================== FLEX SCROLL CONTAINERS ===================== */
#hierarchy-container,
#acum-table-container {
  overflow-y: auto;
  overflow-x: auto;
}

/* ===================== RESPONSIVE ===================== */
@media (max-width: 640px) {
  .app-title { font-size: 0.85rem; }
  .app-header { padding: 6px 10px; }
}

@media (max-width: 1024px) {
  .hierarchy-table .th-origen,
  .hierarchy-table .td-origen {
    min-width: 140px;
  }
}

/* ===================== CHART BARS ===================== */
#chart-bars {
  min-height: 200px;
  height: 100%;
  width: 100%;
  position: relative;
}

@media (min-width: 768px) {
  #chart-bars {
    min-height: 280px;
  }
}

@media (min-width: 1024px) {
  #chart-bars {
    min-height: 320px;
  }
}

@media (min-width: 1280px) {
  #chart-bars {
    min-height: 380px;
  }
}

#chart-bars svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

html.light #chart-bars svg line { stroke: #B2DFDB; }
html.light #chart-bars svg text { fill: #475569; }
html.light #chart-bars circle[stroke="#8B5CF6"] { stroke: #00A99D; }
html.light #chart-bars circle[fill="#8B5CF6"] { fill: #00A99D; }
html.light #chart-bars text[fill="#8B5CF6"] { fill: #00A99D; }
html.light #chart-bars linearGradient stop:first-child { stop-color: #00A99D; }
html.light #chart-bars linearGradient stop:last-child { stop-color: #76E0C2; }

/* ===================== ORIGIN CHART BARS (LIGHT) ===================== */
html.light #origin-chart div[style*="background:#8B5CF6"] { background: #00A99D !important; }
html.light #origin-chart div[style*="background:#EC4899"] { background: #76E0C2 !important; }
html.light #origin-chart div[style*="background:#A78BFA"] { background: #2DD4BF !important; }
html.light #origin-chart div[style*="background:#F472B6"] { background: #5EEAD4 !important; }
html.light #origin-chart div[style*="background:#C084FC"] { background: #00A99D !important; }
html.light #origin-chart div[style*="background:#FB7185"] { background: #76E0C2 !important; }
html.light #origin-chart div[style*="background:#DDD6FE"] { background: #2DD4BF !important; }
html.light #origin-chart div[style*="background:#F9A8D4"] { background: #5EEAD4 !important; }

/* ===================== TREEMAP CHART ===================== */
.treemap-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  width: 100%;
}

.treemap-parent {
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 1px solid rgba(139, 92, 246, 0.12);
}

.treemap-parent:hover {
  border-color: rgba(139, 92, 246, 0.35);
  box-shadow: 0 2px 16px rgba(139, 92, 246, 0.15);
}

.treemap-parent-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  gap: 8px;
  background: rgba(139, 92, 246, 0.08);
  border-bottom: 1px solid rgba(139, 92, 246, 0.1);
}

.treemap-parent-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.treemap-parent-value {
  font-size: 10px;
  font-weight: 600;
  font-family: 'Inter', monospace;
  color: var(--primary);
  white-space: nowrap;
}

.treemap-parent-pct {
  font-size: 9px;
  color: var(--text-muted);
  white-space: nowrap;
}

.treemap-parent-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: rgba(139, 92, 246, 0.12);
  transition: background 0.2s;
  flex-shrink: 0;
}

.treemap-parent-toggle:hover {
  background: rgba(139, 92, 246, 0.25);
}

.treemap-parent-toggle .material-symbols-outlined {
  font-size: 14px;
  color: var(--primary);
}

.treemap-children {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px;
}

.treemap-child {
  border-radius: 6px;
  padding: 6px 8px;
  min-width: 70px;
  min-height: 50px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.25s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.treemap-child::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.08) 0%, transparent 60%);
  pointer-events: none;
}

.treemap-child:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 12px rgba(0,0,0,0.25);
  filter: brightness(1.1);
}

.treemap-child-selected {
  outline: 2px solid #fff;
  outline-offset: -2px;
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.35);
  filter: brightness(1.15);
}

html.light .treemap-child-selected {
  outline-color: var(--primary);
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.treemap-child-label {
  font-size: 9px;
  font-weight: 600;
  color: rgba(255,255,255,0.92);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
  line-height: 1.2;
}

.treemap-child-value {
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
  font-family: 'Inter', monospace;
  line-height: 1.2;
}

.treemap-child-pct {
  font-size: 8px;
  color: rgba(255,255,255,0.7);
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.treemap-parent.collapsed .treemap-children {
  display: none;
}

html.light .treemap-parent {
  border-color: rgba(0, 169, 157, 0.12);
}

html.light .treemap-parent:hover {
  border-color: rgba(0, 169, 157, 0.35);
  box-shadow: 0 2px 16px rgba(0, 169, 157, 0.12);
}

html.light .treemap-parent-header {
  background: rgba(0, 169, 157, 0.06);
  border-bottom-color: rgba(0, 169, 157, 0.1);
}

html.light .treemap-parent-label { color: #0F172A; }
html.light .treemap-parent-value { color: #00A99D; }
html.light .treemap-parent-pct { color: #475569; }

html.light .treemap-parent-toggle {
  background: rgba(0, 169, 157, 0.1);
}

html.light .treemap-parent-toggle:hover {
  background: rgba(0, 169, 157, 0.2);
}

html.light .treemap-parent-toggle .material-symbols-outlined {
  color: #00A99D;
}

html.light .treemap-child-label {
  color: rgba(0,0,0,0.85);
  text-shadow: none;
}

html.light .treemap-child-value {
  color: #0F172A;
  text-shadow: none;
}

html.light .treemap-child-pct {
  color: rgba(0,0,0,0.55);
  text-shadow: none;
}

html.light .treemap-child[style*="rgba(139,92,246"] { background: rgba(0,169,157,0.72) !important; }
html.light .treemap-child[style*="rgba(236,72,153"] { background: rgba(118,224,194,0.72) !important; }
html.light .treemap-child[style*="rgba(167,139,250"] { background: rgba(45,212,191,0.72) !important; }
html.light .treemap-child[style*="rgba(244,114,182"] { background: rgba(94,234,212,0.72) !important; }
html.light .treemap-child[style*="rgba(192,132,252"] { background: rgba(0,169,157,0.65) !important; }
html.light .treemap-child[style*="rgba(251,113,133"] { background: rgba(118,224,194,0.65) !important; }
html.light .treemap-child[style*="rgba(124,58,237"] { background: rgba(0,137,123,0.72) !important; }
html.light .treemap-child[style*="rgba(219,39,119"] { background: rgba(77,182,172,0.72) !important; }
html.light .treemap-child[style*="rgba(99,102,241"] { background: rgba(45,212,191,0.65) !important; }
html.light .treemap-child[style*="rgba(16,185,129"] { background: rgba(0,169,157,0.65) !important; }

html.light #treemap-chart .treemap-parent-header {
  background: rgba(0, 169, 157, 0.06);
  border-bottom-color: rgba(0, 169, 157, 0.1);
}

html.light .treemap-parent-header[style*="border-left: 3px solid #8B5CF6"] { border-left-color: #00A99D !important; }
html.light .treemap-parent-header[style*="border-left: 3px solid #EC4899"] { border-left-color: #76E0C2 !important; }
html.light .treemap-parent-header[style*="border-left: 3px solid #A78BFA"] { border-left-color: #2DD4BF !important; }
html.light .treemap-parent-header[style*="border-left: 3px solid #F472B6"] { border-left-color: #5EEAD4 !important; }
html.light .treemap-parent-header[style*="border-left: 3px solid #C084FC"] { border-left-color: #00A99D !important; }
html.light .treemap-parent-header[style*="border-left: 3px solid #FB7185"] { border-left-color: #76E0C2 !important; }
html.light .treemap-parent-header[style*="border-left: 3px solid #DDD6FE"] { border-left-color: #2DD4BF !important; }
html.light .treemap-parent-header[style*="border-left: 3px solid #6B7280"] { border-left-color: #94A3B8 !important; }

/* ===================== KPI CARDS ===================== */
.glass-panel .text-error { color: var(--error) !important; }
.glass-panel .text-green-400 { color: var(--success) !important; }
.glass-panel .text-error\/70 { color: rgba(244, 63, 94, 0.7) !important; }
.glass-panel .text-green-400\/70 { color: rgba(16, 185, 129, 0.7) !important; }

/* ===================== MULTI-SELECT MONTHS ===================== */
.month-btn-analysis.bg-primary-container\/30 {
  box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.5);
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.25) 0%, rgba(236, 72, 153, 0.15) 100%) !important;
}

html.light .month-btn-analysis.bg-primary-container\/30 {
  box-shadow: 0 0 0 1px rgba(0, 169, 157, 0.4);
  background: linear-gradient(135deg, rgba(0, 169, 157, 0.2) 0%, rgba(118, 224, 194, 0.12) 100%) !important;
}

/* ===================== COMPARE MODULE ===================== */
.compare-delta-th {
  min-width: 48px;
  max-width: 52px;
  text-align: center;
  font-size: 0.5rem;
  color: var(--text-muted);
}

.compare-delta-cell {
  font-weight: 600;
  letter-spacing: 0;
}

.compare-month-btn.bg-primary-container\/30 {
  box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.5);
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.25) 0%, rgba(236, 72, 153, 0.15) 100%) !important;
}

html.light .compare-month-btn.bg-primary-container\/30 {
  box-shadow: 0 0 0 1px rgba(0, 169, 157, 0.4);
  background: linear-gradient(135deg, rgba(0, 169, 157, 0.2) 0%, rgba(118, 224, 194, 0.12) 100%) !important;
}

html.light .compare-delta-th { color: #475569; }
html.light .data-table .row-grand-total td { background: linear-gradient(135deg, rgba(0, 169, 157, 0.1) 0%, rgba(118, 224, 194, 0.05) 100%); }

#compare-table-container {
  overflow-y: auto;
  overflow-x: auto;
}

#compare-months {
  gap: 3px;
}

/* ===================== COMPARE SORT HEADERS ===================== */
.compare-sortable {
  cursor: pointer;
  user-select: none;
  transition: background 0.15s, color 0.15s;
}

.compare-sortable:hover {
  background: rgba(139, 92, 246, 0.12) !important;
  color: var(--primary) !important;
}

.compare-sort-active {
  color: var(--primary) !important;
  font-weight: 700;
}

html.light .compare-sortable:hover {
  background: rgba(0, 169, 157, 0.08) !important;
}

html.light .compare-sort-active {
  color: #00897B !important;
}

/* ===================== GRADIENT ACCENTS ===================== */
.gradient-text {
  background: linear-gradient(135deg, #8B5CF6 0%, #EC4899 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

html.light .gradient-text {
  background: linear-gradient(135deg, #00A99D 0%, #76E0C2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ===================== BUTTON STYLES ===================== */
.year-btn.bg-primary-container\/30,
.year-btn-analysis.bg-primary-container\/30,
.year-btn-compare.bg-primary-container\/30 {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.25) 0%, rgba(236, 72, 153, 0.15) 100%) !important;
  box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.5);
}

html.light .year-btn.bg-primary-container\/30,
html.light .year-btn-analysis.bg-primary-container\/30,
html.light .year-btn-compare.bg-primary-container\/30 {
  background: linear-gradient(135deg, rgba(0, 169, 157, 0.2) 0%, rgba(118, 224, 194, 0.12) 100%) !important;
  box-shadow: 0 0 0 1px rgba(0, 169, 157, 0.4);
}

.quarter-btn.bg-primary-container\/30,
.quarter-btn-analysis.bg-primary-container\/30 {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.25) 0%, rgba(236, 72, 153, 0.15) 100%) !important;
  box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.5);
}

html.light .quarter-btn.bg-primary-container\/30,
html.light .quarter-btn-analysis.bg-primary-container\/30 {
  background: linear-gradient(135deg, rgba(0, 169, 157, 0.2) 0%, rgba(118, 224, 194, 0.12) 100%) !important;
  box-shadow: 0 0 0 1px rgba(0, 169, 157, 0.4);
}

.compare-group-btn.bg-primary-container\/30 {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.25) 0%, rgba(236, 72, 153, 0.15) 100%) !important;
  box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.5);
}

html.light .compare-group-btn.bg-primary-container\/30 {
  background: linear-gradient(135deg, rgba(0, 169, 157, 0.2) 0%, rgba(118, 224, 194, 0.12) 100%) !important;
  box-shadow: 0 0 0 1px rgba(0, 169, 157, 0.4);
}

.chart-mode-btn.bg-primary-container\/30 {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.25) 0%, rgba(236, 72, 153, 0.15) 100%) !important;
  box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.5);
}

html.light .chart-mode-btn.bg-primary-container\/30 {
  background: linear-gradient(135deg, rgba(0, 169, 157, 0.2) 0%, rgba(118, 224, 194, 0.12) 100%) !important;
  box-shadow: 0 0 0 1px rgba(0, 169, 157, 0.4);
}

/* ===================== NAV TABS ===================== */
.nav-tab.active {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.2) 0%, rgba(236, 72, 153, 0.1) 100%) !important;
  border-bottom-color: var(--primary) !important;
}

html.light .nav-tab.active {
  background: linear-gradient(135deg, rgba(0, 169, 157, 0.15) 0%, rgba(118, 224, 194, 0.08) 100%) !important;
}

/* ===================== HEADER ===================== */
.app-header {
  background: rgba(30, 27, 46, 0.85) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(139, 92, 246, 0.2) !important;
}

html.light .app-header {
  background: rgba(255, 255, 255, 0.9) !important;
  border-bottom: 1px solid rgba(0, 169, 157, 0.15) !important;
}

/* ===================== LOGIN OVERLAY ===================== */
.login-overlay {
  background: var(--bg-color);
  overflow: hidden;
}

.login-card {
  position: relative;
  z-index: 10;
  width: 19rem;
  padding: 2.8rem 2.2rem 2.2rem;
  border-radius: 20px;
  text-align: center;
  background: var(--glass-bg, rgba(255, 255, 255, 0.6));
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.35));
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.03),
    0 4px 12px rgba(0, 0, 0, 0.04),
    0 16px 48px rgba(0, 0, 0, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
  animation: loginIn 0.65s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.login-icon-wrap {
  width: 52px;
  height: 52px;
  margin: 0 auto 1.6rem;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.login-icon-wrap .material-symbols-outlined {
  font-size: 26px;
  color: #fff;
}

.login-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-color);
  letter-spacing: -0.02em;
  margin-bottom: 0.35rem;
}

.login-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.login-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.login-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.18) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.25s;
}

.login-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.login-btn:hover::after {
  opacity: 1;
}

.login-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.login-btn-icon {
  font-size: 20px;
  transition: transform 0.25s;
}

.login-btn:hover .login-btn-icon {
  transform: translateX(3px);
}

/* Floating orbs */
.login-orb {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(70px);
  opacity: 0.08;
}

.login-orb--1 {
  width: 420px;
  height: 420px;
  background: var(--primary);
  top: -100px;
  right: -60px;
  animation: orbDrift 16s ease-in-out infinite;
}

.login-orb--2 {
  width: 320px;
  height: 320px;
  background: var(--secondary);
  bottom: -80px;
  left: -40px;
  animation: orbDrift 20s ease-in-out infinite reverse;
}

.login-orb--3 {
  width: 200px;
  height: 200px;
  background: var(--primary);
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: orbPulse 10s ease-in-out infinite;
}

/* === DARK THEME === */
html.dark {
  --glass-bg: rgba(30, 27, 46, 0.75);
  --glass-border: rgba(139, 92, 246, 0.12);
}

html.dark .login-card {
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.1),
    0 4px 12px rgba(0, 0, 0, 0.15),
    0 16px 48px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

html.dark .login-btn {
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.2);
}

html.dark .login-btn:hover {
  box-shadow: 0 6px 24px rgba(139, 92, 246, 0.3);
}

html.dark .login-icon-wrap {
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.25);
}

/* === LIGHT THEME === */
html.light {
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(0, 169, 157, 0.12);
}

html.light .login-overlay {
  background: #EFF9F7;
}

html.light .login-card {
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.02),
    0 4px 12px rgba(0, 0, 0, 0.03),
    0 16px 48px rgba(0, 0, 0, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

html.light .login-btn {
  background: #00A99D;
  box-shadow: 0 2px 8px rgba(0, 169, 157, 0.15);
}

html.light .login-btn:hover {
  box-shadow: 0 6px 20px rgba(0, 169, 157, 0.25);
}

html.light .login-icon-wrap {
  background: #00A99D;
  box-shadow: 0 4px 16px rgba(0, 169, 157, 0.2);
}

html.light .login-orb--1 { background: #00A99D; }
html.light .login-orb--2 { background: #76E0C2; }
html.light .login-orb--3 { background: #00A99D; }

/* ===================== KEYFRAMES ===================== */
@keyframes loginIn {
  0% {
    opacity: 0;
    transform: translateY(20px) scale(0.97);
    filter: blur(4px);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes orbDrift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(25px, -18px) scale(1.03); }
  50% { transform: translate(-10px, 12px) scale(0.97); }
  75% { transform: translate(15px, 8px) scale(1.02); }
}

@keyframes orbPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.06; }
  50% { transform: translate(-50%, -50%) scale(1.2); opacity: 0.1; }
}
