/* =====================================================
   EBANNI ANALYTICS — DESIGN SYSTEM v4
   Single source of truth for all colors, typography,
   spacing and components. Never use hex codes outside
   this file — always consume a CSS variable.
   ===================================================== */


/* ═══════════════════════════════════════════════════
   1. DESIGN TOKENS — DARK (default)
   ═══════════════════════════════════════════════════ */
:root {

  /* ── Brand ──────────────────────────────────────── */
  --color-primary:          #EF8C00;
  --color-primary-hover:    #D47A00;
  --color-primary-dim:      rgba(239, 140, 0, 0.12);
  --color-primary-border:   rgba(239, 140, 0, 0.28);
  --color-secondary:        #782CF6;
  --color-secondary-hover:  #6520D4;
  --color-secondary-dim:    rgba(120, 44, 246, 0.12);
  --color-secondary-border: rgba(120, 44, 246, 0.28);

  /* ── State colors ───────────────────────────────── */
  --c-success:         #10b981;
  --c-success-dim:     rgba(16, 185, 129, 0.12);
  --c-success-border:  rgba(16, 185, 129, 0.26);
  --c-warning:         #f59e0b;
  --c-warning-dim:     rgba(245, 158, 11, 0.12);
  --c-warning-border:  rgba(245, 158, 11, 0.26);
  --c-danger:          #ef4444;
  --c-danger-dim:      rgba(239, 68, 68, 0.12);
  --c-danger-border:   rgba(239, 68, 68, 0.26);
  --c-info:            #3b82f6;
  --c-info-dim:        rgba(59, 130, 246, 0.12);
  --c-info-border:     rgba(59, 130, 246, 0.26);

  /* ── Surfaces & text ────────────────────────────── */
  --bg:              #0D0D10;
  --bg-alt:          #080809;
  --surface:         #17171B;
  --surface-raised:  #202026;
  --border:          rgba(255, 255, 255, 0.07);
  --border-strong:   rgba(255, 255, 255, 0.12);

  /* Typography levels — 3 levels per theme */
  --text-primary:    #FFFFFF;    /* headings, values, interactive */
  --text-secondary:  #BFBFBF;   /* body, labels, secondary info  */
  --text-muted:      #606068;   /* placeholders, disabled, hints  */

  /* ── Icon badge system ──────────────────────────── */
  --icon-bg-primary:        rgba(239, 140, 0,   0.14);
  --icon-border-primary:    rgba(239, 140, 0,   0.30);
  --icon-bg-secondary:      rgba(120, 44,  246, 0.12);
  --icon-border-secondary:  rgba(120, 44,  246, 0.28);
  --icon-bg-success:        rgba(16,  185, 129, 0.12);
  --icon-border-success:    rgba(16,  185, 129, 0.26);
  --icon-bg-warning:        rgba(245, 158, 11,  0.12);
  --icon-border-warning:    rgba(245, 158, 11,  0.26);
  --icon-bg-danger:         rgba(239, 68,  68,  0.12);
  --icon-border-danger:     rgba(239, 68,  68,  0.26);
  --icon-bg-info:           rgba(59,  130, 246, 0.12);
  --icon-border-info:       rgba(59,  130, 246, 0.26);
  --icon-bg-neutral:        rgba(148, 163, 184, 0.10);
  --icon-border-neutral:    rgba(148, 163, 184, 0.20);

  /* ── Table tokens ───────────────────────────────── */
  --table-header-bg:     rgba(16, 185, 129, 0.07);
  --table-header-color:  rgba(110, 231, 183, 0.85);
  --table-row-divider:   rgba(255, 255, 255, 0.05);
  --table-row-hover:     rgba(255, 255, 255, 0.03);

  /* ── Chart tokens ───────────────────────────────── */
  --chart-label:          #BFBFBF;
  --chart-grid:           rgba(255, 255, 255, 0.06);
  --chart-tooltip-bg:     #1e293b;
  --chart-tooltip-text:   #e2e8f0;

  /* ── Misc tokens ────────────────────────────────── */
  --progress-bg:          rgba(255, 255, 255, 0.10);

  /* ── Sidebar ────────────────────────────────────── */
  --sidebar-w:            64px;
  --sidebar-w-expanded:   240px;
  --sidebar-bg:           #141418;
  --sidebar-border:       rgba(255, 255, 255, 0.06);
  --sidebar-hover:        rgba(255, 255, 255, 0.05);
  --sidebar-active:       rgba(239, 140, 0, 0.14);

  /* ── Topbar ─────────────────────────────────────── */
  --topbar-h:             54px;
  --topbar-bg:            rgba(16, 16, 20, 0.94);
  --topbar-border:        rgba(255, 255, 255, 0.07);

  /* ── Shadows ────────────────────────────────────── */
  --shadow-sm:     0 1px 3px rgba(0, 0, 0, 0.5);
  --shadow-md:     0 4px 20px rgba(0, 0, 0, 0.6);
  --shadow-float:  0 8px 40px rgba(0, 0, 0, 0.5),  0 0 0 1px rgba(255, 255, 255, 0.05);
  --shadow-flyout: 0 24px 64px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.08);

  /* ── Typography ─────────────────────────────────── */
  --font-base: 'Inter', system-ui, -apple-system, sans-serif;

  /* ── Radii ──────────────────────────────────────── */
  --radius-sm:   7px;
  --radius-md:   11px;
  --radius-lg:   14px;
  --radius-pill: 22px;

  /* ── Transitions ────────────────────────────────── */
  --t:      140ms ease;
  --t-slow: 260ms cubic-bezier(0.4, 0, 0.2, 1);

  /* ── Layout ─────────────────────────────────────── */
  --float: 12px;

  /* ── Legacy aliases (backward compat) ──────────── */
  --primary-color:    var(--color-primary);
  --secondary-color:  var(--color-secondary);
  --accent-color:     var(--color-primary);
  --dark-bg:          var(--bg);
  --card-bg:          var(--surface);
  --border-color:     var(--border);
  --card-shadow:      var(--shadow-md);
  --color-success:    var(--c-success);
  --color-danger:     var(--c-danger);
  --gradient:         linear-gradient(135deg, #782CF6 0%, #EF8C00 100%);
}


/* ═══════════════════════════════════════════════════
   2. DESIGN TOKENS — LIGHT
   Style guide: bg #F2F2F3 · surface #FFFFFF
                text #000000 · secondary #858585 · muted #BFBFBF
   ═══════════════════════════════════════════════════ */
[data-theme="light"] {

  /* ── Surfaces & text ────────────────────────────── */
  --bg:              #F2F2F3;
  --bg-alt:          #E8E8EA;
  --surface:         #FFFFFF;
  --surface-raised:  #F7F7F9;
  --border:          rgba(0, 0, 0, 0.07);
  --border-strong:   rgba(0, 0, 0, 0.12);
  --text-primary:    #000000;
  --text-secondary:  #555555;
  --text-muted:      #888888;

  /* ── State colors ───────────────────────────────── */
  --c-success:         #059669;
  --c-success-dim:     rgba(5,   150, 105, 0.08);
  --c-success-border:  rgba(5,   150, 105, 0.20);
  --c-warning:         #d97706;
  --c-warning-dim:     rgba(217, 119, 6,   0.08);
  --c-warning-border:  rgba(217, 119, 6,   0.20);
  --c-danger:          #dc2626;
  --c-danger-dim:      rgba(220, 38,  38,  0.08);
  --c-danger-border:   rgba(220, 38,  38,  0.20);
  --c-info:            #2563eb;
  --c-info-dim:        rgba(37,  99,  235, 0.08);
  --c-info-border:     rgba(37,  99,  235, 0.20);

  /* ── Icon badge system ──────────────────────────── */
  --icon-bg-primary:        rgba(239, 140, 0,   0.08);
  --icon-border-primary:    rgba(239, 140, 0,   0.20);
  --icon-bg-secondary:      rgba(120, 44,  246, 0.08);
  --icon-border-secondary:  rgba(120, 44,  246, 0.18);
  --icon-bg-success:        rgba(5,   150, 105, 0.08);
  --icon-border-success:    rgba(5,   150, 105, 0.20);
  --icon-bg-warning:        rgba(217, 119, 6,   0.08);
  --icon-border-warning:    rgba(217, 119, 6,   0.20);
  --icon-bg-danger:         rgba(220, 38,  38,  0.08);
  --icon-border-danger:     rgba(220, 38,  38,  0.20);
  --icon-bg-info:           rgba(37,  99,  235, 0.08);
  --icon-border-info:       rgba(37,  99,  235, 0.20);
  --icon-bg-neutral:        rgba(0,   0,   0,   0.05);
  --icon-border-neutral:    rgba(0,   0,   0,   0.10);

  /* ── Table tokens ───────────────────────────────── */
  --table-header-bg:     rgba(5, 150, 105, 0.06);
  --table-header-color:  #065f46;
  --table-row-divider:   rgba(0, 0, 0, 0.06);
  --table-row-hover:     rgba(0, 0, 0, 0.02);

  /* ── Chart tokens ───────────────────────────────── */
  --chart-label:          #858585;
  --chart-grid:           rgba(0, 0, 0, 0.06);
  --chart-tooltip-bg:     #1e293b;
  --chart-tooltip-text:   #e2e8f0;

  /* ── Misc tokens ────────────────────────────────── */
  --progress-bg:          rgba(0, 0, 0, 0.08);

  /* ── Sidebar ────────────────────────────────────── */
  --sidebar-bg:      #FFFFFF;
  --sidebar-border:  rgba(0, 0, 0, 0.05);
  --sidebar-hover:   rgba(0, 0, 0, 0.04);
  --sidebar-active:  rgba(239, 140, 0, 0.10);

  /* ── Topbar ─────────────────────────────────────── */
  --topbar-bg:       rgba(255, 255, 255, 0.95);
  --topbar-border:   rgba(0, 0, 0, 0.07);

  /* ── Shadows ────────────────────────────────────── */
  --shadow-sm:     0 1px 3px rgba(0, 0, 0, 0.07), 0 0 0 1px rgba(0, 0, 0, 0.04);
  --shadow-md:     0 4px 16px rgba(0, 0, 0, 0.10);
  --shadow-float:  0 4px 28px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.05);
  --shadow-flyout: 0 12px 44px rgba(0, 0, 0, 0.13), 0 0 0 1px rgba(0, 0, 0, 0.07);

  /* ── Legacy aliases ─────────────────────────────── */
  --dark-bg:    var(--bg);
  --card-bg:    var(--surface);
  --card-shadow: var(--shadow-sm);
  --border-color: var(--border);
}


/* ═══════════════════════════════════════════════════
   3. RESET
   ═══════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; }


/* ═══════════════════════════════════════════════════
   4. LAYOUT
   ═══════════════════════════════════════════════════ */
body.eb-layout {
  margin: 0;
  font-family: var(--font-base);
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  padding-left: calc(var(--float) + var(--sidebar-w) + var(--float));
  padding-top: calc(var(--float) + var(--topbar-h) + var(--float));
  transition: padding-left var(--t-slow), background var(--t-slow), color var(--t-slow);
}

body.eb-layout.sidebar-open {
  padding-left: calc(var(--float) + var(--sidebar-w-expanded) + var(--float));
}


/* ═══════════════════════════════════════════════════
   5. SIDEBAR
   ═══════════════════════════════════════════════════ */
#eb-sidebar {
  position: fixed;
  top: calc(var(--float) + 3px);
  left: var(--float);
  bottom: calc(var(--float) + 3px);
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-float);
  z-index: 200;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width var(--t-slow), background var(--t-slow), box-shadow var(--t-slow);
}

#eb-sidebar.open,
#eb-sidebar.peek {
  width: var(--sidebar-w-expanded);
  border-radius: var(--radius-pill);
}
#eb-sidebar.peek {
  box-shadow: 0 12px 48px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.07);
}

/* Brand */
.eb-brand {
  height: 58px;
  display: flex; align-items: center; gap: 11px;
  padding: 0 16px;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}

.eb-brand-mark {
  width: 32px; height: 32px; flex-shrink: 0;
  border-radius: 10px;
  background: linear-gradient(145deg, #FFB240 0%, #EF8C00 55%, #CC7400 100%);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 14px;
  box-shadow: 0 2px 10px rgba(239,140,0,0.4);
}

.eb-brand-name {
  font-size: 13px; font-weight: 700; letter-spacing: -0.02em;
  color: var(--text-primary);
  white-space: nowrap;
  opacity: 0; transition: opacity var(--t-slow);
}
#eb-sidebar.open .eb-brand-name,
#eb-sidebar.peek .eb-brand-name { opacity: 1; }

/* Nav */
.eb-nav {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: 8px 0;
  scrollbar-width: none;
}
.eb-nav::-webkit-scrollbar { display: none; }

.eb-cat { position: relative; }

.eb-cat-btn {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 9px 17px;
  border: none; background: transparent;
  color: var(--text-muted); cursor: pointer; text-align: left;
  font-size: 12.5px; font-weight: 500;
  font-family: var(--font-base);
  white-space: nowrap;
  transition: background var(--t), color var(--t);
}
.eb-cat-btn:hover { background: var(--sidebar-hover); color: var(--text-secondary); }
.eb-cat.active > .eb-cat-btn { color: var(--color-primary); }

.eb-cat-icon {
  width: 30px; height: 30px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; border-radius: var(--radius-sm);
  transition: background var(--t), color var(--t);
}
.eb-cat-btn:hover .eb-cat-icon { color: var(--text-secondary); }
.eb-cat.active > .eb-cat-btn .eb-cat-icon {
  background: var(--sidebar-active);
  color: var(--color-primary);
}

.eb-cat-label   { flex: 1; opacity: 0; transition: opacity var(--t-slow); }
.eb-cat-chevron { font-size: 9px; opacity: 0; transition: opacity var(--t-slow), transform var(--t); }
#eb-sidebar.open .eb-cat-label,
#eb-sidebar.open .eb-cat-chevron,
#eb-sidebar.peek .eb-cat-label,
#eb-sidebar.peek .eb-cat-chevron { opacity: 1; }
.eb-cat.open .eb-cat-chevron { transform: rotate(180deg); }

/* Subnav accordion */
.eb-subnav {
  display: flex; flex-direction: column;
  max-height: 0; overflow: hidden; opacity: 0;
  padding: 0 10px;
  transition:
    max-height 300ms cubic-bezier(0.4, 0, 0.2, 1),
    opacity 240ms ease,
    padding-top 300ms ease,
    padding-bottom 300ms ease;
}
#eb-sidebar:is(.open, .peek) .eb-cat.open .eb-subnav {
  max-height: 600px; opacity: 1;
  padding-top: 3px; padding-bottom: 8px;
}

.eb-sub-link {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 12px;
  color: var(--text-secondary); text-decoration: none;
  font-size: 13px; border-radius: var(--radius-sm);
  transition: background var(--t), color var(--t);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.eb-sub-link i { font-size: 12px; width: 14px; text-align: center; flex-shrink: 0; }
.eb-sub-link:hover { background: var(--sidebar-hover); color: var(--color-primary); }
.eb-sub-link.active {
  color: var(--color-primary); font-weight: 600;
  background: var(--sidebar-active);
}

/* Flyout */
.eb-flyout {
  display: none;
  position: fixed;
  left: calc(var(--float) + var(--sidebar-w) + 10px);
  min-width: 210px; max-width: 250px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-flyout);
  padding: 10px 0;
  z-index: 300;
  overflow: hidden;
}
.eb-flyout-title {
  padding: 8px 18px 10px;
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--color-primary);
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}
.eb-flyout-link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 18px;
  color: var(--text-secondary); text-decoration: none;
  font-size: 13px;
  transition: background var(--t), color var(--t);
  white-space: nowrap;
}
.eb-flyout-link i { font-size: 12px; width: 14px; text-align: center; color: var(--text-muted); transition: color var(--t); }
.eb-flyout-link:hover { background: var(--sidebar-hover); color: var(--text-primary); }
.eb-flyout-link:hover i { color: var(--color-primary); }
.eb-flyout-link.active { color: var(--color-primary); font-weight: 600; }
.eb-flyout-link.active i { color: var(--color-primary); }

#eb-sidebar:not(.open):not(.peek) .eb-cat:hover .eb-flyout { display: block; }

/* Sidebar footer */
.eb-sidebar-footer {
  padding: 10px 12px;
  border-top: 1px solid var(--sidebar-border);
  display: flex; align-items: center; gap: 6px;
  flex-shrink: 0; overflow: hidden;
}
#eb-sidebar:not(.open):not(.peek) .eb-sidebar-footer { justify-content: center; padding: 10px 0; }
#eb-sidebar:not(.open):not(.peek) .eb-logout-label { display: none; }

.eb-logout-btn {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 8px; border-radius: var(--radius-sm);
  background: rgba(239, 68, 68, 0.07);
  border: 1px solid rgba(239, 68, 68, 0.14);
  color: #ef4444; cursor: pointer;
  font-size: 12px; font-weight: 600;
  font-family: var(--font-base);
  transition: background var(--t);
  white-space: nowrap; flex-shrink: 0;
}
.eb-logout-btn:hover { background: rgba(239, 68, 68, 0.15); }

.eb-logout-label { font-size: 11.5px; opacity: 0; width: 0; overflow: hidden; transition: opacity var(--t-slow); }
#eb-sidebar.open .eb-logout-label,
#eb-sidebar.peek .eb-logout-label { opacity: 1; width: auto; }


/* ═══════════════════════════════════════════════════
   6. TOPBAR
   ═══════════════════════════════════════════════════ */
#eb-topbar {
  position: fixed;
  top: var(--float);
  left: calc(var(--float) + var(--sidebar-w) + var(--float));
  right: var(--float);
  height: var(--topbar-h);
  background: var(--topbar-bg);
  border: 1px solid var(--topbar-border);
  border-radius: var(--radius-pill);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  box-shadow: var(--shadow-float);
  z-index: 100;
  display: flex; align-items: center;
  padding: 0 14px; gap: 10px;
  transition: left var(--t-slow);
}

body.eb-layout.sidebar-open #eb-topbar {
  left: calc(var(--float) + var(--sidebar-w-expanded) + var(--float));
}

/* Breadcrumb */
.eb-breadcrumb {
  display: flex; align-items: center;
  gap: 5px; flex: 1; min-width: 0;
  font-size: 13px;
}
.eb-breadcrumb a {
  color: var(--text-muted); text-decoration: none; font-weight: 400;
  transition: color var(--t); white-space: nowrap;
  display: flex; align-items: center; gap: 4px;
}
.eb-breadcrumb a:hover { color: var(--text-primary); }
.eb-bc-home    { font-size: 12px; color: var(--text-muted); }
.eb-bc-cat     { color: var(--text-secondary); font-weight: 400; }
.eb-bc-sep     { color: var(--text-muted); opacity: 0.4; font-size: 11px; }
.eb-bc-current { color: var(--color-primary); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Topbar action zones */
.eb-topbar-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.eb-topbar-right {
  display: flex; align-items: center; gap: 2px; flex-shrink: 0;
  margin-left: 4px; padding-left: 10px;
  border-left: 1px solid var(--border);
}
.eb-topbar-icon-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); border-radius: var(--radius-sm); font-size: 16px;
  transition: color var(--t), background var(--t);
}
.eb-topbar-icon-btn:hover { background: var(--color-primary-dim); color: var(--color-primary); }
/* Logout visible solo en móvil (sidebar oculto, no hay otro punto de salida) */
.eb-topbar-logout-mobile { display: none; }
@media (max-width: 767px) { .eb-topbar-logout-mobile { display: flex; } }

/* Content wrapper */
.eb-content { padding: 20px; min-height: calc(100vh - var(--topbar-h)); }


/* ═══════════════════════════════════════════════════
   7. TYPOGRAPHY — utility classes
   Use these everywhere; never hardcode sizes/colors.
   ═══════════════════════════════════════════════════ */

/* Level 0 — Display hero (e.g. "Hola, San Juan") */
.eb-display {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: -0.025em;
  line-height: 1.15;
}

/* Level 1 — Page title */
.eb-page-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: -0.015em;
  line-height: 1.3;
}

/* Level 2 — Section heading (inside content, above a card group) */
.eb-section-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
}

/* Level 3 — Card / subsection heading */
.eb-card-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-primary);
  line-height: 1.4;
}

/* Level 4 — Body, primary content */
.eb-body {
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--text-primary);
  line-height: 1.55;
}

/* Level 5 — Body secondary */
.eb-body-2 {
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--text-secondary);
  line-height: 1.55;
}

/* Level 6 — Small / helper text */
.eb-small {
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Level 7 — Caption / supplementary */
.eb-caption {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Level 8 — Label (filter labels, column headers, badges) */
.eb-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  line-height: 1;
}

/* KPI numeric display variants */
.eb-kpi-lg {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.eb-kpi {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.eb-kpi-sm {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}


/* ═══════════════════════════════════════════════════
   8. CARDS — component classes
   ═══════════════════════════════════════════════════ */

/* Standard card */
.eb-card {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  transition: border-color var(--t), box-shadow var(--t), transform var(--t);
}
.eb-card:hover {
  border-color: var(--color-primary-border);
  box-shadow: var(--shadow-md);
}
[data-theme="light"] .eb-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.08), 0 0 0 1px rgba(239,140,0,0.18);
  transform: translateY(-1px);
}

/* Raised card — for nested / secondary content */
.eb-card-inner {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
}

/* Card header divider */
.eb-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-bottom: 0.75rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}


/* ═══════════════════════════════════════════════════
   9. ICON BADGES
   Usage: <div class="eb-icon eb-icon-primary"><i class="fas fa-..."></i></div>
   ═══════════════════════════════════════════════════ */
.eb-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
}
.eb-icon-sm { width: 1.625rem; height: 1.625rem; font-size: 0.75rem;   border-radius: 6px; }
.eb-icon-lg { width: 2.5rem;   height: 2.5rem;   font-size: 1.0625rem; border-radius: var(--radius-md); }

.eb-icon-primary   { background: var(--icon-bg-primary);   border: 1px solid var(--icon-border-primary);   color: var(--color-primary);   }
.eb-icon-secondary { background: var(--icon-bg-secondary); border: 1px solid var(--icon-border-secondary); color: var(--color-secondary); }
.eb-icon-success   { background: var(--icon-bg-success);   border: 1px solid var(--icon-border-success);   color: var(--c-success);       }
.eb-icon-warning   { background: var(--icon-bg-warning);   border: 1px solid var(--icon-border-warning);   color: var(--c-warning);       }
.eb-icon-danger    { background: var(--icon-bg-danger);    border: 1px solid var(--icon-border-danger);    color: var(--c-danger);        }
.eb-icon-info      { background: var(--icon-bg-info);      border: 1px solid var(--icon-border-info);      color: var(--c-info);          }
.eb-icon-neutral   { background: var(--icon-bg-neutral);   border: 1px solid var(--icon-border-neutral);   color: var(--text-muted);      }


/* ═══════════════════════════════════════════════════
   10. BADGES / TAGS
   Usage: <span class="eb-badge eb-badge-success">OK</span>
   ═══════════════════════════════════════════════════ */
.eb-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: 0.01em;
}
.eb-badge-primary   { background: var(--color-primary-dim);   color: var(--color-primary);   border: 1px solid var(--color-primary-border);   }
.eb-badge-secondary { background: var(--color-secondary-dim); color: var(--color-secondary); border: 1px solid var(--color-secondary-border); }
.eb-badge-success   { background: var(--c-success-dim);       color: var(--c-success);       border: 1px solid var(--c-success-border);       }
.eb-badge-warning   { background: var(--c-warning-dim);       color: var(--c-warning);       border: 1px solid var(--c-warning-border);       }
.eb-badge-danger    { background: var(--c-danger-dim);        color: var(--c-danger);        border: 1px solid var(--c-danger-border);        }
.eb-badge-info      { background: var(--c-info-dim);          color: var(--c-info);          border: 1px solid var(--c-info-border);          }
.eb-badge-neutral   { background: var(--icon-bg-neutral);     color: var(--text-secondary);  border: 1px solid var(--icon-border-neutral);    }


/* ═══════════════════════════════════════════════════
   11. BUTTONS
   Usage: <button class="eb-btn eb-btn-primary">Actualizar</button>
   ═══════════════════════════════════════════════════ */
.eb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  font-family: var(--font-base);
  cursor: pointer;
  white-space: nowrap;
  line-height: 1;
  transition: background var(--t), color var(--t), box-shadow var(--t), transform var(--t);
}
.eb-btn:active { transform: translateY(1px); }
.eb-btn-sm { padding: 0.3rem 0.7rem; font-size: 0.8125rem; border-radius: var(--radius-sm); }
.eb-btn-lg { padding: 0.7rem 1.5rem; font-size: 0.9375rem; border-radius: var(--radius-lg); }

/* Primary — orange fill */
.eb-btn-primary { background: var(--color-primary); color: #0a0a0d; }
.eb-btn-primary:hover { background: var(--color-primary-hover); box-shadow: 0 4px 14px rgba(239,140,0,0.35); }

/* Secondary — purple fill */
.eb-btn-secondary { background: var(--color-secondary); color: #ffffff; }
.eb-btn-secondary:hover { background: var(--color-secondary-hover); box-shadow: 0 4px 14px rgba(120,44,246,0.35); }

/* Ghost — subtle border */
.eb-btn-ghost { background: var(--surface-raised); color: var(--text-secondary); border: 1px solid var(--border-strong); }
.eb-btn-ghost:hover { color: var(--text-primary); border-color: var(--color-primary-border); }

/* Danger */
.eb-btn-danger { background: var(--c-danger-dim); color: var(--c-danger); border: 1px solid var(--c-danger-border); }
.eb-btn-danger:hover { background: var(--c-danger); color: white; box-shadow: 0 4px 14px rgba(239,68,68,0.35); }

/* Success */
.eb-btn-success { background: var(--c-success-dim); color: var(--c-success); border: 1px solid var(--c-success-border); }
.eb-btn-success:hover { background: var(--c-success); color: white; }

/* Warning */
.eb-btn-warning { background: var(--c-warning-dim); color: var(--c-warning); border: 1px solid var(--c-warning-border); }
.eb-btn-warning:hover { background: var(--c-warning); color: white; }


/* ═══════════════════════════════════════════════════
   12. INPUTS
   Usage: <input class="eb-input" type="text">
   ═══════════════════════════════════════════════════ */
.eb-input {
  background: var(--surface-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-family: var(--font-base);
  color: var(--text-primary);
  width: 100%;
  outline: none;
  transition: border-color var(--t), box-shadow var(--t);
}
.eb-input::placeholder { color: var(--text-muted); }
.eb-input:focus {
  border-color: rgba(239, 140, 0, 0.50);
  box-shadow: 0 0 0 3px rgba(239, 140, 0, 0.10);
}
[data-theme="light"] .eb-input                                                  { color: var(--text-primary); }
[data-theme="light"] .eb-input option                                           { color: var(--text-primary); background: var(--surface); }
[data-theme="light"] input[type="date"].eb-input::-webkit-datetime-edit          { color: var(--text-primary); }
[data-theme="light"] input[type="date"].eb-input::-webkit-datetime-edit-fields-wrapper { color: var(--text-primary); }


/* ═══════════════════════════════════════════════════
   13. TABLES
   Usage: <table class="eb-table">
   ═══════════════════════════════════════════════════ */
.eb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}
.eb-table thead tr  { background: var(--table-header-bg); }
.eb-table thead th  {
  padding: 0.6rem 0.75rem;
  text-align: left;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--table-header-color);
  white-space: nowrap;
}
.eb-table tbody tr  { border-top: 1px solid var(--table-row-divider); transition: background var(--t); }
.eb-table tbody tr:hover { background: var(--table-row-hover); }
.eb-table td        { padding: 0.6rem 0.75rem; color: var(--text-primary); vertical-align: middle; }
.eb-table td.muted  { color: var(--text-muted); font-size: 0.75rem; }
.eb-table td.sec    { color: var(--text-secondary); }


/* ═══════════════════════════════════════════════════
   14. PROGRESS BARS
   Usage: <div class="eb-progress"><div class="eb-progress-fill eb-progress-success" style="width:72%"></div></div>
   ═══════════════════════════════════════════════════ */
.eb-progress    { height: 6px;  background: var(--progress-bg); border-radius: 9999px; overflow: hidden; }
.eb-progress-md { height: 8px;  background: var(--progress-bg); border-radius: 9999px; overflow: hidden; }
.eb-progress-lg { height: 10px; background: var(--progress-bg); border-radius: 9999px; overflow: hidden; }

.eb-progress-fill         { height: 100%; border-radius: 9999px; transition: width 0.45s ease; }
.eb-progress-primary      { background: var(--color-primary);   }
.eb-progress-secondary    { background: var(--color-secondary); }
.eb-progress-success      { background: var(--c-success);       }
.eb-progress-warning      { background: var(--c-warning);       }
.eb-progress-danger       { background: var(--c-danger);        }
.eb-progress-info         { background: var(--c-info);          }


/* ═══════════════════════════════════════════════════
   15. MOBILE OVERLAY & RESPONSIVE
   ═══════════════════════════════════════════════════ */
.eb-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(2px);
  z-index: 190;
}
.eb-overlay.visible { display: block; }

@media (max-width: 768px) {
  body.eb-layout {
    padding-left: 0;
    padding-top: calc(var(--topbar-h) + 10px + 8px);
  }
  body.eb-layout.sidebar-open { padding-left: 0; }
  #eb-topbar {
    top: 8px; left: 8px !important; right: 8px;
    border-radius: var(--radius-lg);
  }
  #eb-sidebar {
    top: 0; left: 0; bottom: 0;
    border-radius: 0 var(--radius-pill) var(--radius-pill) 0;
    transform: translateX(-110%);
    transition: transform var(--t-slow), box-shadow var(--t-slow);
    width: var(--sidebar-w-expanded) !important;
  }
  #eb-sidebar.open { transform: translateX(0); }
}


/* ═══════════════════════════════════════════════════
   16. LEGACY COMPONENT OVERRIDES
   Keeps backward compat with older HTML pages
   that haven't migrated to eb-* classes yet.
   ═══════════════════════════════════════════════════ */
.card-header {
  background: rgba(239, 140, 0, 0.04) !important;
}
.dashboard-card {
  border-color: var(--border) !important;
  background: var(--card-bg) !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
[data-theme="light"] .dashboard-card {
  box-shadow: var(--shadow-sm) !important;
  border-color: rgba(0,0,0,0.06) !important;
}
[data-theme="light"] .dashboard-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.09), 0 0 0 1px rgba(239,140,0,0.22) !important;
  border-color: rgba(239,140,0,0.22) !important;
  transform: translateY(-1px);
}

/* Global table fix for un-migrated pages */
[data-theme="light"] td,
[data-theme="light"] th { color: var(--text-primary); }


/* ═══════════════════════════════════════════════════
   CHART PATTERN — copy this snippet into any page
   that renders ApexCharts or Chart.js

   function getChartTheme() {
     const s = getComputedStyle(document.documentElement);
     const v = (n) => s.getPropertyValue(n).trim();
     return {
       label:     v('--chart-label'),
       grid:      v('--chart-grid'),
       tooltip:   { bg: v('--chart-tooltip-bg'), text: v('--chart-tooltip-text') },
       surface:   v('--surface'),
       primary:   v('--color-primary'),
       secondary: v('--color-secondary'),
       success:   v('--c-success'),
       warning:   v('--c-warning'),
       danger:    v('--c-danger'),
       info:      v('--c-info'),
       text1:     v('--text-primary'),
       text2:     v('--text-secondary'),
     };
   }

   // Re-render on theme change (add once per page):
   new MutationObserver(() => renderMyChart())
     .observe(document.documentElement,
       { attributes: true, attributeFilter: ['data-theme'] });
   ═══════════════════════════════════════════════════ */
