/* --- DESIGN SYSTEM & CSS VARIABLES --- */
:root {
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Outfit', sans-serif;

  /* Color Palette (HSL curated for harmonious dark mode) */
  --bg-dark: hsl(224, 25%, 8%);
  --bg-card: rgba(17, 24, 43, 0.65);
  --bg-card-hover: rgba(26, 36, 62, 0.85);
  --bg-input: rgba(10, 15, 30, 0.5);
  
  --primary: hsl(263, 85%, 66%);
  --primary-glow: rgba(147, 51, 234, 0.3);
  --secondary: hsl(190, 90%, 55%);
  --secondary-glow: rgba(6, 182, 212, 0.25);
  
  --text: hsl(210, 25%, 97%);
  --text-muted: hsl(215, 16%, 72%);
  --text-dim: hsl(218, 12%, 50%);
  
  --border: rgba(255, 255, 255, 0.07);
  --border-focus: rgba(147, 51, 234, 0.5);
  
  --success: hsl(142, 72%, 50%);
  --success-glow: rgba(34, 197, 94, 0.2);
  --warning: hsl(38, 92%, 55%);
  --warning-glow: rgba(245, 158, 11, 0.2);
  --danger: hsl(350, 80%, 55%);
  --danger-glow: rgba(239, 68, 68, 0.2);
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.7);
  
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(at 10% 10%, rgba(147, 51, 234, 0.08) 0px, transparent 50%),
    radial-gradient(at 90% 90%, rgba(6, 182, 212, 0.07) 0px, transparent 50%),
    radial-gradient(at 50% 10%, rgba(17, 24, 43, 0.5) 0px, transparent 100%);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* --- TYPOGRAPHY --- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* --- APP HEADER --- */
.app-header {
  height: 70px;
  background: rgba(10, 15, 30, 0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.3rem;
  color: white;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.header-logo h1 {
  font-size: 1.4rem;
  font-weight: 700;
  background: linear-gradient(to right, #ffffff, #d8b4fe);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* DB Connection Badges */
.status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid transparent;
  transition: var(--transition-normal);
}

.status-badge.loading {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
}

.status-badge.postgres {
  background: var(--success-glow);
  border-color: rgba(34, 197, 94, 0.3);
  color: var(--success);
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.1);
}

.status-badge.local {
  background: var(--warning-glow);
  border-color: rgba(245, 158, 11, 0.3);
  color: var(--warning);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.1);
}

.indicator-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: currentColor;
  display: inline-block;
}

.postgres .indicator-dot, .local .indicator-dot {
  animation: pulse 1.8s infinite ease-in-out;
}

@keyframes pulse {
  0% { opacity: 0.4; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.1); }
  100% { opacity: 0.4; transform: scale(0.9); }
}

/* --- APP LAYOUT --- */
.app-container {
  display: flex;
  flex: 1;
}

/* Sidebar */
.app-sidebar {
  width: 260px;
  background: rgba(12, 17, 34, 0.35);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px 16px;
  position: sticky;
  top: 70px;
  height: calc(100vh - 70px);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-btn {
  background: transparent;
  border: 1px solid transparent;
  padding: 12px 16px;
  border-radius: 8px;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  text-align: left;
  transition: var(--transition-fast);
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
}

.nav-btn.active {
  background: rgba(147, 51, 234, 0.12);
  border-color: rgba(147, 51, 234, 0.2);
  color: var(--primary);
  box-shadow: inset 3px 0 0 var(--primary);
}

.nav-icon {
  font-size: 1.1rem;
}

.sidebar-footer {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.5;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

/* Main Content Area */
.app-main-content {
  flex: 1;
  padding: 32px;
  overflow-y: auto;
}

/* Overview Metrics Bar */
.overview-metrics-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.metric-card {
  background: var(--bg-card);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-fast);
}

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

.metric-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

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

.metric-value {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.metric-sub {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.metric-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

/* --- TABS SYSTEM --- */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* --- GLOBAL CARDS --- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  margin-bottom: 24px;
  overflow: hidden;
}

.card.glass {
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
}

.card-body {
  padding: 24px;
}

.card-sub {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
}

/* --- DASHBOARD GRID & SIMULATOR --- */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 24px;
}

.dashboard-col {
  display: flex;
  flex-direction: column;
}

.select-wrapper select {
  min-width: 200px;
}

/* Pricing suggestion banner */
.pricing-card-banner {
  background: linear-gradient(135deg, rgba(147, 51, 234, 0.15) 0%, rgba(6, 182, 212, 0.15) 100%);
  border: 1px solid rgba(147, 51, 234, 0.25);
  border-radius: 14px;
  padding: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.pricing-card-banner::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(147, 51, 234, 0.1) 0%, transparent 60%);
  pointer-events: none;
}

.pricing-banner-side {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.banner-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--secondary);
  letter-spacing: 0.05em;
}

.banner-value {
  font-family: var(--font-display);
  font-size: 2.8rem;
  font-weight: 800;
  color: white;
  text-shadow: 0 0 16px rgba(147, 51, 234, 0.3);
}

.banner-badge {
  background: rgba(255, 255, 255, 0.08);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
  align-self: flex-start;
  text-transform: uppercase;
}

/* Pricing Formula Math Display */
.formula-box {
  background: rgba(10, 15, 30, 0.45);
  border: 1px solid var(--border);
  padding: 12px 18px;
  border-radius: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.formula-label {
  display: block;
  font-size: 0.7rem;
  margin-bottom: 6px;
  color: var(--text-dim);
  text-transform: uppercase;
}

.formula-display {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.9rem;
}

.fraction {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  vertical-align: middle;
  padding: 0 4px;
}

.fraction .top {
  border-bottom: 1px solid var(--text-muted);
  padding-bottom: 2px;
  width: 100%;
  text-align: center;
}

.fraction .bottom {
  padding-top: 2px;
  text-align: center;
}

/* Margin Range Slider Control */
.margin-slider-control {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.slider-header label {
  font-weight: 500;
  color: var(--text);
  font-size: 0.95rem;
}

.slider-badge {
  background: rgba(147, 51, 234, 0.15);
  border: 1px solid var(--primary);
  border-radius: 6px;
  padding: 4px 8px;
  display: flex;
  align-items: center;
  gap: 2px;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--primary);
}

.slider-badge input {
  background: transparent;
  border: none;
  color: inherit;
  font-weight: inherit;
  font-size: 1.1rem;
  width: 30px;
  text-align: right;
  outline: none;
}

/* Remove spin arrows from input number */
.slider-badge input::-webkit-outer-spin-button,
.slider-badge input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Premium Slider styling */
.premium-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  margin: 8px 0;
}

.premium-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: 2px solid white;
  box-shadow: 0 0 10px var(--primary-glow);
  transition: transform 0.1s ease;
}

.premium-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.slider-limits {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* Pricing alert banner */
.pricing-alert {
  display: flex;
  gap: 16px;
  padding: 16px 20px;
  border-radius: 10px;
  margin-bottom: 24px;
  border-width: 1px;
  border-style: solid;
  animation: slideIn 0.3s ease;
}

.pricing-alert.warning {
  background: var(--warning-glow);
  border-color: rgba(245, 158, 11, 0.3);
  color: hsl(38, 92%, 80%);
}

.pricing-alert.danger {
  background: var(--danger-glow);
  border-color: rgba(239, 68, 68, 0.3);
  color: hsl(350, 80%, 80%);
}

.pricing-alert.success {
  background: var(--success-glow);
  border-color: rgba(34, 197, 94, 0.3);
  color: hsl(142, 72%, 80%);
}

.alert-icon {
  font-size: 1.4rem;
  line-height: 1;
}

.alert-text h4 {
  font-size: 0.9rem;
  margin-bottom: 4px;
  font-weight: 600;
}

.alert-text p {
  font-size: 0.8rem;
  opacity: 0.9;
}

@keyframes slideIn {
  from { transform: translateY(-10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Empty States */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 16px;
}

.empty-state h3 {
  font-size: 1.1rem;
  margin-bottom: 8px;
  color: #fff;
}

.empty-state p {
  font-size: 0.85rem;
  max-width: 320px;
  margin: 0 auto;
}

.hidden {
  display: none !important;
}

/* Chart sizing wrappers */
.chart-container-wrapper {
  position: relative;
  width: 100%;
  height: 230px;
  margin-top: 16px;
}

/* Competitor Benchmark List */
.competitors-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.competitor-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: var(--transition-fast);
}

.competitor-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.comp-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.comp-name {
  font-weight: 600;
  font-size: 0.9rem;
}

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

.comp-price-value {
  color: #fff;
  font-weight: 500;
}

.comp-features {
  font-size: 0.75rem;
  color: var(--text-dim);
  line-height: 1.4;
}

/* --- PREMIUM TABLES --- */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

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

.premium-table th {
  padding: 14px 16px;
  border-bottom: 2px solid var(--border);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.premium-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.premium-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.premium-table tbody tr:last-child td {
  border-bottom: none;
}

.premium-table tfoot td {
  padding: 16px;
  border-top: 2px solid var(--border);
}

.text-right {
  text-align: right;
}

.text-center {
  text-align: center;
}

/* Badges for tables */
.badge {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge.desarrollo {
  background: rgba(147, 51, 234, 0.15);
  color: var(--primary);
  border: 1px solid rgba(147, 51, 234, 0.3);
}

.badge.qa {
  background: rgba(6, 182, 212, 0.15);
  color: var(--secondary);
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.badge.produccion {
  background: var(--success-glow);
  color: var(--success);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

/* --- BUTTONS --- */
.btn {
  font-family: var(--font-sans);
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition-fast);
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-primary:hover {
  background: hsl(263, 85%, 70%);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border);
  color: var(--text);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
}

.btn-danger {
  background: var(--danger-glow);
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--danger);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.3);
}

.btn-sm {
  padding: 4px 8px;
  font-size: 0.75rem;
  border-radius: 4px;
}

/* Action icons inside tables */
.table-actions {
  display: flex;
  gap: 8px;
}

/* --- FORM CONTROLS --- */
.form-group {
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.form-input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  color: white;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  outline: none;
  transition: var(--transition-fast);
}

.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 8px var(--primary-glow);
}

.form-input::placeholder {
  color: var(--text-dim);
}

select.form-input {
  cursor: pointer;
}

/* Custom Radio button group */
.radio-group {
  display: flex;
  gap: 20px;
  margin-top: 6px;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.85rem;
}

.radio-label input[type="radio"] {
  display: none;
}

.custom-radio {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-radius: 50%;
  display: inline-block;
  position: relative;
  transition: var(--transition-fast);
}

.radio-label input[type="radio"]:checked + .custom-radio {
  border-color: var(--primary);
}

.radio-label input[type="radio"]:checked + .custom-radio::after {
  content: '';
  width: 10px;
  height: 10px;
  background: var(--primary);
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* --- ALLOCATION CONFIG PANEL --- */
.allocation-config-section {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 10px;
  padding: 18px;
  border: 1px solid var(--border);
  margin-top: 10px;
  margin-bottom: 18px;
}

.allocation-config-section h4 {
  font-size: 0.95rem;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
  color: #fff;
}

.distribution-matrix-box h5 {
  font-size: 0.85rem;
  margin-top: 14px;
  margin-bottom: 8px;
  color: var(--text-muted);
}

.allocation-warning {
  background: var(--danger-glow);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--danger);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.78rem;
  margin-bottom: 10px;
}

.allocation-table {
  width: 100%;
  border-collapse: collapse;
}

.allocation-table th {
  padding: 8px;
  text-align: left;
  font-size: 0.75rem;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
}

.allocation-table td {
  padding: 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.checkbox-center {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* --- MODAL DIALOGS --- */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 200;
  justify-content: center;
  align-items: center;
  padding: 20px;
  animation: fadeIn 0.25s ease;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  width: 100%;
  max-width: 500px;
  max-height: calc(100vh - 40px);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-content.modal-large {
  max-width: 680px;
}

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

.modal-header h3 {
  font-size: 1.15rem;
  color: white;
}

.close-btn {
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: var(--transition-fast);
}

.close-btn:hover {
  color: #fff;
}

.modal-content form {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.modal-footer {
  margin-top: 24px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

/* --- RESPONSIVE LAYOUT BREAKPOINTS --- */
@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  
  .app-container {
    flex-direction: column;
  }
  
  .app-sidebar {
    width: 100%;
    height: auto;
    position: relative;
    top: 0;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
  }
  
  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .sidebar-footer {
    display: none;
  }
}

@media (max-width: 600px) {
  .app-header {
    padding: 0 16px;
  }
  
  .app-main-content {
    padding: 16px;
  }
  
  .pricing-card-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  
  .pricing-banner-side.right {
    width: 100%;
  }
}

/* --- LIGHT THEME VARIABLES & OVERRIDES --- */
body.light-theme {
  --bg-dark: hsl(220, 20%, 95%);
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-hover: rgba(240, 245, 255, 0.9);
  --bg-input: rgba(220, 225, 240, 0.8);
  
  --primary: hsl(263, 80%, 50%);
  --primary-glow: rgba(147, 51, 234, 0.15);
  --secondary: hsl(190, 85%, 40%);
  --secondary-glow: rgba(6, 182, 212, 0.15);
  
  --text: hsl(224, 25%, 12%);
  --text-muted: hsl(220, 16%, 35%);
  --text-dim: hsl(220, 12%, 55%);
  
  --border: rgba(0, 0, 0, 0.08);
  --border-focus: rgba(147, 51, 234, 0.4);
  
  --success: hsl(142, 72%, 35%);
  --success-glow: rgba(34, 197, 94, 0.1);
  --warning: hsl(38, 92%, 40%);
  --warning-glow: rgba(245, 158, 11, 0.1);
  --danger: hsl(350, 80%, 45%);
  --danger-glow: rgba(239, 68, 68, 0.1);
  
  background-image: 
    radial-gradient(at 10% 10%, rgba(147, 51, 234, 0.05) 0px, transparent 50%),
    radial-gradient(at 90% 90%, rgba(6, 182, 212, 0.04) 0px, transparent 50%),
    radial-gradient(at 50% 10%, rgba(240, 244, 248, 0.8) 0px, transparent 100%);
}

body.light-theme .app-header {
  background: rgba(240, 244, 250, 0.8);
}

body.light-theme .app-sidebar {
  background: rgba(235, 240, 250, 0.5);
}

body.light-theme h1, body.light-theme h2, body.light-theme h3, body.light-theme h4, body.light-theme h5 {
  color: hsl(224, 25%, 12%);
}

body.light-theme .metric-value {
  color: hsl(224, 25%, 12%);
}

body.light-theme .logo-icon {
  color: white;
}

body.light-theme .header-logo h1 {
  background: linear-gradient(to right, #1e1b4b, #581c87);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

body.light-theme .banner-value {
  color: hsl(224, 25%, 12%);
  text-shadow: none;
}

body.light-theme .formula-box {
  background: rgba(0, 0, 0, 0.03);
  color: var(--text-muted);
}

body.light-theme .form-input {
  color: hsl(224, 25%, 12%);
}

body.light-theme .form-input::placeholder {
  color: hsl(220, 12%, 60%);
}

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

body.light-theme .allocation-config-section {
  background: rgba(0, 0, 0, 0.02);
}

body.light-theme .close-btn {
  color: var(--text-muted);
}
body.light-theme .close-btn:hover {
  color: var(--text);
}

/* Theme Toggle Button Styling */
.theme-toggle-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text);
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.2rem;
  transition: var(--transition-fast);
  margin-right: 12px;
}

.theme-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

body.light-theme .theme-toggle-btn {
  background: rgba(0, 0, 0, 0.05);
  border-color: var(--border);
  color: var(--text);
}

body.light-theme .theme-toggle-btn:hover {
  background: rgba(0, 0, 0, 0.08);
}

/* Period Selector Header Component */
.period-selector-container {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 16px;
  background: rgba(255, 255, 255, 0.03);
  padding: 4px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
}

body.light-theme .period-selector-container {
  background: rgba(0, 0, 0, 0.02);
}

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

.period-select {
  padding: 6px 12px !important;
  background: transparent !important;
  border: none !important;
  font-weight: 600;
  font-size: 0.85rem !important;
  color: var(--text) !important;
  cursor: pointer;
  outline: none;
  min-width: 125px !important;
}

.period-select option {
  background: var(--bg-dark);
  color: var(--text);
}

/* Actualizar Cloud cost button */
.btn-sync {
  background: rgba(6, 182, 212, 0.15) !important;
  border-color: rgba(6, 182, 212, 0.3) !important;
  color: var(--secondary) !important;
}

.btn-sync:hover {
  background: rgba(6, 182, 212, 0.3) !important;
}

/* Header actions alignment correction */
.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* User session styles in header */
.user-info-header {
  border-left: 1px solid var(--border);
  padding-left: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Login Overlay styling */
.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(8, 12, 24, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.login-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: rgba(17, 24, 43, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 40px;
  box-shadow: var(--shadow-lg), 0 0 50px rgba(147, 51, 234, 0.15);
  transform: translateY(20px);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.login-overlay.active .login-card {
  transform: translateY(0);
}

.login-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.login-header .logo-icon {
  width: 50px;
  height: 50px;
  font-size: 1.6rem;
  border-radius: 12px;
}

.login-header h2 {
  font-size: 1.8rem;
  font-weight: 800;
  background: linear-gradient(to right, #ffffff, #d8b4fe);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.login-header p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.login-error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  text-align: center;
}

.login-footer {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.login-footer p {
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--text-muted);
}

.login-footer ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.login-footer li {
  font-family: monospace;
}

/* Light Theme Overrides for Login Overlay */
body.light-theme .login-overlay {
  background: rgba(240, 244, 250, 0.85);
}

body.light-theme .login-card {
  background: rgba(255, 255, 255, 0.8);
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: var(--shadow-lg), 0 0 50px rgba(147, 51, 234, 0.08);
}

