/* ============================================================
   DARK ANALYTICS THEME — Orange Edition
   Inspired by premium dark dashboard UI
   ============================================================ */
:root {
  /* ── Core Backgrounds ── */
  --bg-dark:       #111318;        /* Near-black base — deep charcoal */
  --bg-surface:    #181b22;        /* Main surface layer */
  --bg-card:       rgba(26, 29, 38, 0.9);   /* Card panels */
  --bg-card-hover: rgba(30, 34, 46, 0.95);
  --bg-input:      rgba(22, 25, 34, 0.8);
  --bg-elevated:   #1e222e;        /* Slightly raised element bg */

  /* ── Border System ── */
  --border-color:      rgba(255, 255, 255, 0.06);
  --border-subtle:     rgba(255, 255, 255, 0.04);
  --border-highlight:  rgba(255, 107, 43, 0.45);
  --border-active:     rgba(255, 107, 43, 0.7);

  /* ── Typography ── */
  --text-main:    #f0f2f5;
  --text-muted:   #8a92a6;
  --text-dim:     #545c6e;
  --text-inverse: #111318;

  /* ── DEFAULT PRIMARY — Vibrant Orange ── */
  --primary:       #ff6b2b;
  --primary-light: #ff8c5a;
  --primary-dark:  #e04f10;
  --primary-hover: #ff7a3d;
  --primary-glow:  rgba(255, 107, 43, 0.28);
  --primary-bg:    rgba(255, 107, 43, 0.10);
  --primary-bg-sm: rgba(255, 107, 43, 0.06);
  --shadow-orange: 0 8px 28px rgba(255, 107, 43, 0.35);

  /* ── SECONDARY — Teal/Cyan ── */
  --teal:     #00c9a7;
  --teal-bg:  rgba(0, 201, 167, 0.10);
  --cyan:     #22d3ee;

  /* ── Semantic Colors ── */
  --success:      #22c55e;
  --success-bg:   rgba(34, 197, 94, 0.10);
  --warning:      #f59e0b;
  --warning-bg:   rgba(245, 158, 11, 0.10);
  --danger:       #f43f5e;
  --danger-bg:    rgba(244, 63, 94, 0.10);
  --purple:       #a78bfa;
  --purple-bg:    rgba(167, 139, 250, 0.10);

  /* ── Shadows & Glows ── */
  --shadow-sm:     0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md:     0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg:     0 16px 48px rgba(0, 0, 0, 0.6);
  --shadow-card:   0 4px 16px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255,255,255,0.04);

  /* ── Shape & Motion ── */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- THEME VARIATION OVERRIDES (ONLY COLOUR & OPACITY, NO SHAPE CHANGES) --- */
/* Theme 1: Vibrant (Brillante / Neón - Actual) */
html[data-theme="vibrant"], body[data-theme="vibrant"] {
  --primary:          #ff6b2b !important;
  --primary-light:    #ff8c5a !important;
  --primary-dark:     #e04f10 !important;
  --primary-hover:    #ff7a3d !important;
  --primary-glow:     rgba(255, 107, 43, 0.35) !important;
  --primary-bg:       rgba(255, 107, 43, 0.12) !important;
  --border-highlight: rgba(255, 107, 43, 0.45) !important;
  --shadow-orange:    0 8px 28px rgba(255, 107, 43, 0.35) !important;
  --bg-card:          rgba(26, 29, 38, 0.95) !important;
}

/* Theme 2: Medium (Cálido / Equilibrio - Menos Resplandor) */
html[data-theme="medium"], body[data-theme="medium"] {
  --primary:          #d85422 !important;
  --primary-light:    #e57041 !important;
  --primary-dark:     #a83d15 !important;
  --primary-hover:    #c4491c !important;
  --primary-glow:     rgba(216, 84, 34, 0.15) !important;
  --primary-bg:       rgba(216, 84, 34, 0.08) !important;
  --border-highlight: rgba(216, 84, 34, 0.30) !important;
  --shadow-orange:    0 4px 16px rgba(216, 84, 34, 0.20) !important;
  --bg-card:          rgba(24, 27, 35, 0.85) !important;
}

/* Theme 3: Muted (Opaco / Mate / Suave) */
html[data-theme="muted"], body[data-theme="muted"] {
  --primary:          #99421f !important;
  --primary-light:    #b05934 !important;
  --primary-dark:     #732f13 !important;
  --primary-hover:    #87391a !important;
  --primary-glow:     rgba(153, 66, 31, 0.08) !important;
  --primary-bg:       rgba(153, 66, 31, 0.06) !important;
  --border-highlight: rgba(153, 66, 31, 0.20) !important;
  --shadow-orange:    0 2px 10px rgba(153, 66, 31, 0.12) !important;
  --bg-card:          rgba(20, 22, 29, 0.80) !important;
}



* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
  background-color: var(--bg-dark);
  background-image:
    radial-gradient(ellipse at 15% 0%,   rgba(255, 107, 43, 0.10) 0px, transparent 45%),
    radial-gradient(ellipse at 85% 100%, rgba(255, 107, 43, 0.07) 0px, transparent 45%),
    radial-gradient(ellipse at 50% 50%,  rgba(0,  201, 167, 0.04) 0px, transparent 60%);
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  padding-bottom: 60px;
}

.container {
  max-width: 1350px;
  margin: 0 auto;
  padding: 24px 20px;
}

/* ── Mobile-safe tap highlight ── */
button, select, input, a {
  -webkit-tap-highlight-color: transparent;
}

/* Header Section */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 0 24px var(--primary-glow);
}

.brand h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(to right, #ffffff, #c0c8d8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand p {
  font-size: 13px;
  color: var(--text-muted);
}

.api-badge-info {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid var(--border-color);
  padding: 8px 16px;
  border-radius: 50px;
  font-size: 13px;
}

.api-key-snippet {
  font-family: monospace;
  color: var(--cyan);
  background: rgba(6, 182, 212, 0.1);
  padding: 2px 8px;
  border-radius: 4px;
}

/* KPI Dashboard Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-highlight);
  box-shadow: var(--shadow);
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.stat-icon.total   { background: var(--primary-bg);  color: var(--primary); }
.stat-icon.demo    { background: var(--teal-bg);      color: var(--teal); }
.stat-icon.monthly { background: var(--primary-bg);   color: var(--primary-light); }
.stat-icon.annual  { background: var(--warning-bg);   color: var(--warning); }

.stat-info h3 {
  font-size: 22px;
  font-weight: 700;
}

.stat-info p {
  font-size: 12px;
  color: var(--text-muted);

}

/* Controls & Filters Bar */
.controls-section {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.search-box-container {
  position: relative;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 16px;
}

.search-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px 14px 44px;
  color: var(--text-main);
  font-size: 15px;
  outline: none;
  transition: var(--transition);
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
  background: rgba(30, 41, 59, 0.9);
}

.keyboard-hint {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  color: var(--text-muted);
  pointer-events: none;
}

/* Filter Tabs & Selects */
.filters-wrapper {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.filter-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.filter-tab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}

.filter-tab:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
}

.filter-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 4px 16px var(--primary-glow);
}

.filter-selects {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.custom-select {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  outline: none;
  cursor: pointer;
  transition: var(--transition);
}

.custom-select:hover, .custom-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-bg);
}

.view-toggle {
  display: flex;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
}

.toggle-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 10px var(--primary-glow);
}

/* Card Grid Layout */
.packages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 20px;
}

.pkg-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.pkg-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-dark), var(--primary), var(--primary-light));
  opacity: 0;
  transition: var(--transition);
}

.pkg-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-highlight);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--border-highlight);
}

.pkg-card:hover::before {
  opacity: 1;
}

.pkg-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}

.pkg-id-badge {
  background: var(--primary-bg);
  color: var(--primary);
  border: 1px solid rgba(255, 107, 43, 0.25);
  font-family: monospace;
  font-weight: 700;
  font-size: 14px;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
}

.pkg-id-badge:hover {
  background: var(--primary);
  color: var(--text-inverse);
  transform: scale(1.05);
  box-shadow: 0 4px 12px var(--primary-glow);
}

.pkg-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 50px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-demo     { background: var(--teal-bg);     color: var(--teal);    border: 1px solid rgba(0,  201, 167, 0.3); }
.badge-official { background: var(--primary-bg);  color: var(--primary); border: 1px solid rgba(255, 107, 43,  0.3); }
.badge-xxx      { background: var(--danger-bg);   color: var(--danger);  border: 1px solid rgba(244, 63,  94,  0.3); }
.badge-no-xxx   { background: rgba(34, 211, 238, 0.10); color: var(--cyan); border: 1px solid rgba(34, 211, 238, 0.3); }

.pkg-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 16px;
  color: var(--text-main);
  min-height: 44px;
}

.pkg-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 18px;
}

.metric-item {
  display: flex;
  flex-direction: column;
}

.metric-label {
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 2px;
}

.metric-val {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}

.pkg-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.btn {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: var(--transition);
}

.btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: var(--shadow-orange);
  transform: translateY(-1px);
}

/* Table View Layout */
.table-container {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow-x: auto;
}

.packages-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.packages-table th {
  background: rgba(20, 23, 32, 0.9);
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
}

.packages-table td {
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 14px;
  vertical-align: middle;
}

.packages-table tr:hover td {
  background: rgba(255, 107, 43, 0.04);
}

.table-actions {
  display: flex;
  gap: 6px;
}

/* Modal Styling */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(10, 12, 18, 0.88);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 720px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 107, 43, 0.12);
  transform: translateY(20px);
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .modal-box {
  transform: translateY(0);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  transition: var(--transition);
}

.modal-close:hover {
  color: var(--text-main);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.code-block-wrapper {
  position: relative;
  background: #090d16;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
}

.code-block {
  font-family: 'Fira Code', 'Cascadia Code', monospace;
  font-size: 13px;
  color: var(--primary-light);
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 250px;
  overflow-y: auto;
}

.btn-copy-code {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 4px 10px;
  font-size: 11px;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
}

.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border-highlight);
  color: var(--text-main);
  padding: 13px 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-orange);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13.5px;
  animation: slideIn 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.toast i {
  color: var(--primary);
  font-size: 16px;
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ============================================================
   RESPONSIVE — Mobile only. Desktop untouched.
   ============================================================ */
@media (max-width: 768px) {
  html, body { overflow-x: hidden; }

  .container { padding: 12px 10px; }

  /* ── Header: brand en una fila, controles en fila compacta ── */
  header {
    flex-direction: column;
    align-items: stretch;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 10px;
  }
  /* Brand takes available space, truncates subtitle */
  .brand {
    gap: 8px;
    flex: 1;
    min-width: 0;
  }
  .brand > div:last-child {
    min-width: 0;
  }
  .brand h1 {
    font-size: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .brand p {
    font-size: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-dim);
  }
  .brand-icon { width: 34px; height: 34px; font-size: 15px; flex-shrink: 0; }

  /* Right-side div: only show sync button, hide everything else */
  header > div:last-child {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    flex-shrink: 0;
  }
  header > div:last-child .api-badge-info,
  header > div:last-child .desktop-only-select { display: none !important; }
  #btn-force-sync {
    font-size: 13px;
    padding: 7px 10px;
    flex-shrink: 0;
  }

  /* ── Nav: scroll horizontal, botones pequeños ── */
  .main-nav {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap;
    gap: 5px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
  }
  .main-nav::-webkit-scrollbar { display: none; }
  .nav-btn {
    white-space: nowrap;
    flex-shrink: 0;
    padding: 7px 12px;
    font-size: 12px;
    gap: 5px;
  }
  .nav-btn i { font-size: 11px; }

  /* ── Stats: scroll horizontal, 3 tarjetas visibles ── */
  .stats-grid {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 4px;
  }
  .stats-grid::-webkit-scrollbar { display: none; }
  .stat-card {
    flex: 0 0 30vw;
    min-width: 95px;
    max-width: 130px;
    padding: 10px 10px;
    gap: 8px;
    flex-direction: column;
    align-items: flex-start;
  }
  .stat-icon    { width: 28px; height: 28px; font-size: 13px; }
  .stat-info h3 { font-size: 14px; }
  .stat-info p  { font-size: 10px; line-height: 1.3; }

  /* ── Controls ── */
  .controls-section { padding: 10px; gap: 8px; margin-bottom: 12px; }
  .filters-wrapper  { flex-direction: column; align-items: stretch; gap: 8px; }
  .filter-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap;
    padding-bottom: 2px;
    gap: 5px;
  }
  .filter-tabs::-webkit-scrollbar { display: none; }
  .filter-tab { flex-shrink: 0; padding: 6px 10px; font-size: 11px; }
  .filter-selects {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
  }
  .filter-selects .custom-select {
    flex: 1 1 calc(50% - 3px);
    min-width: 110px;
    font-size: 11px;
    padding: 6px 8px;
  }
  .view-toggle { margin-left: auto; }
  .toggle-btn { padding: 5px 9px; }

  /* ── Packages grid: 1 col ── */
  .packages-grid { grid-template-columns: 1fr; gap: 10px; }
  .pkg-card      { padding: 14px 12px; }
  .pkg-actions   { grid-template-columns: 1fr 1fr; gap: 7px; }
  .btn           { padding: 8px 10px; font-size: 12px; }

  /* ── Income header ── */
  .income-header-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    margin-bottom: 12px;
  }
  .income-header-bar > div:last-child {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
  }
  .income-header-bar h2 { font-size: 16px; }
  .income-header-bar p  { font-size: 11px; }
  .switch-usd-label     { font-size: 11px; }
  .switch-usd-container { padding: 6px 10px; gap: 8px; }

  /* ── Banks: scroll horizontal, 3 visibles ── */
  .banks-grid {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 4px;
  }
  .banks-grid::-webkit-scrollbar { display: none; }
  .bank-card {
    flex: 0 0 30vw !important;
    width: 30vw !important;
    min-width: 88px;
    max-width: 130px;
    padding: 10px 10px;
    gap: 4px;
  }
  .bank-amount { font-size: 14px; }
  .bank-title  { font-size: 11px; gap: 5px; }
  .bank-count  { font-size: 10px; }

  /* ── Tables: horizontal scroll ── */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-md);
  }
  .packages-table th,
  .packages-table td { padding: 8px 10px; font-size: 11px; white-space: nowrap; }

  /* ── Matrix ── */
  .matrix-container { padding: 12px 10px; }
  .matrix-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    margin-bottom: 12px;
  }
  .matrix-date-add { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; }
  .matrix-date-add > * { flex: 1 1 auto; min-width: 90px; font-size: 12px; }
  .matrix-table th,
  .matrix-table td { padding: 8px 8px; font-size: 11px; white-space: nowrap; }
  .rate-input-inline { width: 64px; font-size: 11px; }

  /* ── Modal ── */
  .modal-box {
    width: 94%;
    max-width: 520px;
    max-height: 90vh;
  }
  .modal-header { padding: 14px 16px; }
  .modal-body   { padding: 14px 16px; gap: 12px; }
  .modal-title  { font-size: 15px; }

  /* ── Toast ── */
  .toast-container { bottom: 12px; right: 8px; left: 8px; }
  .toast { width: 100%; font-size: 12px; padding: 10px 14px; }
}

/* ── Extra compacto ≤ 390px ── */
@media (max-width: 390px) {
  .container { padding: 10px 8px; }
  .stat-card  { min-width: 95px; }
  .bank-card  { min-width: 88px; }
  .sale-modal-row { grid-template-columns: 1fr; }
}

/* ============================================================
   MAIN NAVIGATION BAR
   ============================================================ */
.main-nav {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
}

.nav-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}

.nav-btn:hover {
  color: var(--text-main);
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.15);
}

.nav-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 4px 16px var(--primary-glow);
}

/* ============================================================
   CONTROL DE INGRESOS & USD SWITCH
   ============================================================ */
.income-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.switch-usd-container {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  padding: 8px 16px;
  border-radius: 50px;
  border: 1px solid var(--border-highlight);
}

.switch-usd-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

.switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--bg-input);
  transition: .3s;
  border-radius: 24px;
  border: 1px solid var(--border-color);
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 2px;
  bottom: 2px;
  background-color: var(--text-muted);
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--primary);
}

input:checked + .slider:before {
  transform: translateX(22px);
  background-color: #fff;
}

/* Bank Receivers Grid */
.banks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.bank-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: var(--transition);
}

.bank-card:hover {
  border-color: var(--border-highlight);
  transform: translateY(-2px);
}

.bank-title {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

.bank-amount {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary-light);
}

.bank-count {
  font-size: 12px;
  color: var(--text-dim);
}

/* ============================================================
   TASASVIEW MATRIX TABLE (Fecha x Moneda)
   ============================================================ */
.matrix-container {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 24px;
}

.matrix-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 16px;
}

.matrix-date-add {
  display: flex;
  align-items: center;
  gap: 10px;
}

.matrix-table {
  width: 100%;
  border-collapse: collapse;
  text-align: center;
}

.matrix-table th {
  background: rgba(20, 23, 32, 0.95);
  color: var(--primary-light);
  font-size: 13px;
  font-weight: 700;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
}

.matrix-table td {
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.matrix-table td.editable-cell:hover {
  background: rgba(255, 107, 43, 0.15);
  color: var(--primary);
  outline: 1px dashed var(--primary);
}

.rate-input-inline {
  width: 90px;
  background: var(--bg-dark);
  border: 1px solid var(--primary);
  color: #fff;
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: 700;
  text-align: center;
  outline: none;
}

/* Sale Modal 2-col row — collapses on mobile */
.sale-modal-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 480px) {
  .sale-modal-row {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   SETTINGS DRAWER (slide from left)
   ============================================================ */

/* Hamburger button — always visible, but hidden on desktop */
.settings-toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  display: none;        /* hidden on desktop */
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.settings-toggle-btn:hover { color: var(--primary); }

/* Desktop: show theme selector inline, hide drawer button */
.desktop-only-select { display: block; }

/* Overlay */
.settings-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  z-index: 1100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
}
.settings-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

/* Drawer panel */
.settings-drawer {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: 280px;
  max-width: 80vw;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border-highlight);
  box-shadow: 4px 0 32px rgba(0,0,0,0.5);
  z-index: 1200;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}
.settings-drawer.open {
  transform: translateX(0);
}

.settings-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-color);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}

.settings-drawer-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.settings-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Mobile: show hamburger, hide desktop selector */
@media (max-width: 768px) {
  .settings-toggle-btn    { display: flex; }
  .desktop-only-select    { display: none !important; }

  /* Smaller bank receptor text */
  .bank-amount { font-size: 13px !important; }
  .bank-title  { font-size: 10px !important; }
  .bank-count  { font-size: 10px !important; }
}

/* ============================================================
   SORTABLE TABLE HEADERS
   ============================================================ */
.sortable-th {
  cursor: pointer;
  user-select: none;
  transition: var(--transition);
}
.sortable-th:hover {
  color: var(--primary-light);
  background: rgba(255, 107, 43, 0.08);
}
.sort-icon {
  font-size: 11px;
  margin-left: 5px;
  opacity: 0.35;
  transition: var(--transition);
}
.sortable-th:hover .sort-icon {
  opacity: 0.8;
}
.sortable-th.active-sort {
  color: var(--primary-light);
}
.sortable-th.active-sort .sort-icon {
  opacity: 1;
  color: var(--primary);
}

/* ============================================================
   $1M PREMIUM DATE RANGE PICKER (Linear / Stripe / Ads Manager)
   ============================================================ */
.date-picker-trigger-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-highlight);
  color: var(--text-main);
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
}

.date-picker-trigger-btn:hover {
  border-color: var(--primary);
  background: var(--bg-card-hover);
  box-shadow: 0 6px 20px var(--primary-glow);
  transform: translateY(-1px);
}

.date-picker-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 1200;
  background: var(--bg-elevated);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(255, 107, 43, 0.2);
  backdrop-filter: blur(16px);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px) scale(0.98);
  transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  min-width: 460px;
}

.date-picker-popover.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.date-picker-popover-body {
  display: grid;
  grid-template-columns: 190px 1fr;
  min-height: 270px;
}

/* Presets Sidebar */
.date-presets-list {
  background: rgba(11, 14, 20, 0.7);
  border-right: 1px solid var(--border-color);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  border-top-left-radius: var(--radius-lg);
  border-bottom-left-radius: var(--radius-lg);
}

.date-preset-item {
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 9px;
  transition: all 0.16s ease;
}

.date-preset-item i {
  font-size: 12px;
  width: 14px;
  text-align: center;
  color: var(--text-dim);
}

.date-preset-item:hover {
  background: rgba(255, 107, 43, 0.12);
  color: var(--primary-light);
}

.date-preset-item:hover i {
  color: var(--primary);
}

.date-preset-item.active {
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 3px 10px var(--primary-glow);
}

.date-preset-item.active i {
  color: #fff;
}

/* Custom Panel */
.date-custom-panel {
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.date-panel-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 14px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.date-inputs-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.date-input-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.date-input-group label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.date-picker-input {
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
}

.date-picker-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

.date-picker-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}

@media (max-width: 600px) {
  .date-picker-popover {
    position: fixed;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) scale(0.95) !important;
    width: 92vw;
    min-width: unset;
    max-height: 90vh;
    overflow-y: auto;
  }
  .date-picker-popover.open {
    transform: translate(-50%, -50%) scale(1) !important;
  }
  .date-picker-popover-body {
    grid-template-columns: 1fr;
  }
  .date-presets-list {
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    border-radius: 0;
  }
}

/* ============================================================
   CONTINGENCIA FACEBOOK ADS STYLES
   ============================================================ */
.contingency-graph-container {
  position: relative;
  min-height: 520px;
  width: 100%;
  overflow-x: auto;
  background: radial-gradient(circle at 50% 50%, rgba(255, 107, 0, 0.03) 0%, rgba(13, 17, 23, 0.95) 100%);
  border-radius: 10px;
  border: 1px solid var(--border-color);
}

.contingency-svg-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.contingency-nodes-layer {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  padding: 20px 15px;
  min-width: 950px;
  gap: 20px;
}

.node-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
  align-items: center;
}

.node-column-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.8px;
  margin-bottom: 8px;
  text-align: center;
  border-bottom: 1px dashed var(--border-color);
  padding-bottom: 8px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.c-node-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 12px 14px;
  width: 100%;
  max-width: 210px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.c-node-card:hover {
  transform: translateY(-4px) scale(1.02);
  border-color: var(--primary);
  box-shadow: 0 8px 24px rgba(255, 107, 0, 0.25);
  z-index: 5;
}

.c-node-card.status-active {
  border-left: 4px solid #10b981;
}

.c-node-card.status-review {
  border-left: 4px solid #f59e0b;
}

.c-node-card.status-banned {
  border-left: 4px solid #ef4444;
  background: rgba(239, 68, 68, 0.08);
}

.c-node-card.status-backup {
  border-left: 4px solid #6b7280;
  opacity: 0.85;
}

.c-node-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.c-node-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.icon-profile { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.icon-bm { background: rgba(168, 85, 247, 0.15); color: #a855f7; }
.icon-adaccount { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.icon-page { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.icon-pixel { background: rgba(236, 72, 153, 0.15); color: #ec4899; }
.icon-kommo { background: rgba(139, 92, 246, 0.15); color: #8b5cf6; }

.c-node-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.c-node-role {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.c-node-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.c-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.c-badge-active { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.c-badge-review { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.c-badge-banned { background: rgba(239, 68, 68, 0.2); color: #ef4444; }
.c-badge-backup { background: rgba(107, 114, 128, 0.15); color: #9ca3af; }

.c-kommo-tag {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
}

/* ============================================================
   SECURITY PIN LOCK SCREEN STYLES
   ============================================================ */
.security-lock-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: radial-gradient(circle at 50% 30%, rgba(255, 107, 0, 0.12) 0%, rgba(13, 17, 23, 0.98) 100%);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.security-lock-screen.unlocked {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transform: scale(1.05);
}

.lock-card {
  background: var(--bg-card);
  border: 1px solid var(--border-highlight);
  border-radius: 16px;
  padding: 35px 30px;
  width: 100%;
  max-width: 380px;
  text-align: center;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.9), 0 0 30px rgba(255, 107, 0, 0.15);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lock-icon {
  width: 65px;
  height: 65px;
  background: rgba(255, 107, 0, 0.15);
  color: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin-bottom: 18px;
  border: 1px solid rgba(255, 107, 0, 0.3);
  box-shadow: 0 0 20px rgba(255, 107, 0, 0.2);
}

.lock-card h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}

.lock-card p {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 22px;
}

.pin-input-group {
  display: flex;
  gap: 10px;
  width: 100%;
  margin-bottom: 12px;
}

.pin-input-group input {
  flex: 1;
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 12px;
  border-radius: 8px;
  font-size: 18px;
  letter-spacing: 4px;
  text-align: center;
  outline: none;
  transition: all 0.2s ease;
}

.pin-input-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 12px var(--primary-glow);
}

.lock-error-msg {
  font-size: 12px;
  color: #ef4444;
  font-weight: 600;
  min-height: 20px;
  margin-top: 4px;
}

.lock-footer {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 15px;
}




