/* ═══════════════════════════════════════════════════
   MIIA Design System v3 — Brand Identity 2026
   Gradient: #00E5FF → #7C3AED → #FF1744
   Font: Inter 300–900
   ═══════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ── Shared tokens (both themes) ── */
:root {
  /* ── MIIA Brand Colors ── */
  --indigo:    #7C3AED;   /* Violeta marca */
  --indigo-hi: #9F67FF;   /* Violeta claro */
  --cyan:      #00E5FF;   /* Cian marca */
  --emerald:   #34D399;   /* Verde estado */
  --amber:     #f59e0b;
  --rose:      #FF1744;   /* Rojo marca */

  /* ── Radius ── */
  --r-sm:   8px;
  --r-md:   10px;
  --r-lg:   16px;
  --r-xl:   22px;
  --r-2xl:  30px;
  --r-full: 9999px;

  /* ── Legacy aliases ── */
  --primary:         var(--indigo);
  --primary-dark:    #6025CC;
  --primary-glow:    rgba(124,58,237,.25);
  --secondary:       var(--indigo-hi);
  --accent:          var(--cyan);
  --accent-green:    var(--emerald);
  --accent-green-dark: #0ea370;
  --danger:          var(--rose);
  --warning:         var(--amber);
  --gradient-main:   linear-gradient(135deg, #00E5FF 0%, #7C3AED 50%, #FF1744 100%);
  --gradient-card:   transparent;
  --gradient-hero:   linear-gradient(135deg, #00E5FF 0%, #7C3AED 50%, #FF1744 100%);
  --radius-sm:  var(--r-sm);
  --radius-md:  var(--r-md);
  --radius-lg:  var(--r-lg);
  --radius-xl:  var(--r-xl);
  --radius-full:var(--r-full);
}

/* ── DARK THEME (default) ── */
[data-theme="dark"], :root:not([data-theme]) {
  --base:      #030712;
  --surface:   #0d1117;
  --raise:     #111827;
  --lift:      #1a2236;
  --indigo-lo: rgba(124,58,237,.12);
  --cyan-lo:   rgba(0,229,255,.10);

  --tx-bright: #f8fafc;
  --tx-body:   #94a3b8;
  --tx-dim:    #475569;

  --bd-1: rgba(148,163,184,.07);
  --bd-2: rgba(148,163,184,.12);
  --bd-indigo: rgba(124,58,237,.20);

  --shadow-sm:  0 1px 3px rgba(0,0,0,.4);
  --shadow-md:  0 4px 16px rgba(0,0,0,.5);
  --shadow-lg:  0 16px 48px rgba(0,0,0,.7);
  --shadow-indigo: 0 0 24px rgba(124,58,237,.15);
  --shadow-card: 0 2px 12px rgba(0,0,0,.35), inset 0 1px 0 rgba(148,163,184,.04);

  --glass-bg:     rgba(13,17,23,.75);
  --glass-border: rgba(148,163,184,.08);

  --bg-deep:     var(--base);
  --bg-card:     var(--surface);
  --bg-surface:  var(--raise);
  --bg-elevated: var(--lift);
  --bg-white:    var(--surface);
  --bg-light:    var(--base);
  --bg-panel:    var(--raise);
  --text-dark:   var(--tx-bright);
  --text-body:   var(--tx-body);
  --text-muted:  var(--tx-dim);
  --border-glass:  var(--bd-1);
  --border-subtle: var(--bd-1);

  /* Overlay/backdrop colors */
  --overlay-bg: rgba(3,7,18,.85);
  --sidebar-bg: rgba(7,10,20,.92);
  --navbar-bg:  rgba(3,7,18,.88);
}

/* ── LIGHT THEME (estilo Firebase/Google Cloud) ── */
[data-theme="light"] {
  --base:      #f1f3f4;
  --surface:   #ffffff;
  --raise:     #f8f9fa;
  --lift:      #e8eaed;
  --indigo-lo: rgba(124,58,237,.08);
  --cyan-lo:   rgba(0,229,255,.06);

  --tx-bright: #202124;
  --tx-body:   #3c4043;
  --tx-dim:    #5f6368;

  --bd-1: #dadce0;
  --bd-2: #c4c7cc;
  --bd-indigo: rgba(124,58,237,.25);

  --shadow-sm:  0 1px 2px rgba(60,64,67,.3), 0 1px 3px 1px rgba(60,64,67,.15);
  --shadow-md:  0 1px 2px rgba(60,64,67,.3), 0 2px 6px 2px rgba(60,64,67,.15);
  --shadow-lg:  0 4px 8px 3px rgba(60,64,67,.15), 0 1px 3px rgba(60,64,67,.3);
  --shadow-indigo: 0 0 20px rgba(124,58,237,.12);
  --shadow-card: 0 1px 2px rgba(60,64,67,.3), 0 1px 3px 1px rgba(60,64,67,.15);

  --glass-bg:     rgba(255,255,255,.95);
  --glass-border: #dadce0;

  --bg-deep:     var(--base);
  --bg-card:     var(--surface);
  --bg-surface:  var(--raise);
  --bg-elevated: var(--lift);
  --bg-white:    var(--surface);
  --bg-light:    var(--base);
  --bg-panel:    var(--raise);
  --text-dark:   var(--tx-bright);
  --text-body:   var(--tx-body);
  --text-muted:  var(--tx-dim);
  --border-glass:  var(--bd-1);
  --border-subtle: var(--bd-1);

  --overlay-bg: rgba(0,0,0,.5);
  --sidebar-bg: #ffffff;
  --navbar-bg:  rgba(255,255,255,.95);
}

/* ═══ RESET ═══ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--tx-body);
  background: var(--base);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--indigo-hi); text-decoration: none; }
a:hover { color: var(--cyan); text-decoration: none; }
.hidden { display: none !important; }

/* ═══ ANIMATIONS ═══ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16,185,129,.35); }
  50%       { box-shadow: 0 0 0 6px rgba(16,185,129,0); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes slideIn {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}

.fade-in { opacity: 0; transform: translateY(14px); transition: opacity .5s ease, transform .5s ease; }
.fade-in.visible { opacity: 1; transform: translateY(0); }

/* ═══ NAVBAR (landing) ═══ */
#navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 60px;
  background: var(--navbar-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--bd-1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 40px;
  z-index: 100;
  transition: all .3s;
}
#navbar.scrolled { height: 54px; box-shadow: var(--shadow-sm); }

.nav-logo {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--tx-bright);
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}
.nav-logo-icon {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--indigo), var(--cyan));
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .9rem; color: white;
}
.nav-logo:hover { text-decoration: none; color: var(--tx-bright); }
.nav-actions { display: flex; align-items: center; gap: 14px; }
.nav-email { font-size: .82rem; color: var(--tx-dim); }

.nav-plan-badge {
  padding: 4px 11px;
  border-radius: var(--r-full);
  font-size: .72rem;
  font-weight: 600;
  background: var(--indigo-lo);
  color: var(--indigo-hi);
  border: 1px solid var(--bd-indigo);
}

/* ═══ BUTTONS ═══ */
.btn-primary {
  padding: 9px 22px;
  background: var(--indigo);
  color: white;
  border: none;
  border-radius: var(--r-full);
  font-weight: 700;
  font-size: .88rem;
  cursor: pointer;
  transition: all .2s;
  font-family: inherit;
  letter-spacing: .01em;
}
.btn-primary:hover {
  background: var(--indigo-hi);
  box-shadow: 0 4px 16px rgba(124,58,237,.35);
  transform: translateY(-1px);
}
.btn-primary:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-secondary {
  padding: 9px 20px;
  background: transparent;
  color: var(--tx-body);
  border: 1px solid var(--bd-2);
  border-radius: var(--r-full);
  cursor: pointer;
  font-weight: 600;
  font-size: .85rem;
  transition: all .2s;
  font-family: inherit;
}
.btn-secondary:hover {
  background: var(--raise);
  color: var(--tx-bright);
  border-color: var(--bd-indigo);
}

.btn-ghost {
  padding: 9px 20px;
  background: transparent;
  color: var(--cyan);
  border: 1px solid rgba(0,229,255,.25);
  border-radius: var(--r-full);
  cursor: pointer;
  font-weight: 600;
  font-size: .85rem;
  transition: all .2s;
  font-family: inherit;
}
.btn-ghost:hover {
  background: var(--cyan-lo);
  border-color: var(--cyan);
  box-shadow: 0 0 12px rgba(0,229,255,.15);
}

.btn-small {
  padding: 5px 12px;
  border: none;
  border-radius: var(--r-md);
  font-weight: 600;
  font-size: .78rem;
  cursor: pointer;
  transition: all .2s;
  font-family: inherit;
}
.btn-danger  { background: rgba(244,63,94,.12); color: var(--rose); border: 1px solid rgba(244,63,94,.2); }
.btn-danger:hover  { background: rgba(244,63,94,.22); }
.btn-won     { background: rgba(16,185,129,.12); color: var(--emerald); border: 1px solid rgba(16,185,129,.2); }
.btn-won:hover     { background: rgba(16,185,129,.22); }
.btn-lost    { background: rgba(244,63,94,.12); color: var(--rose); border: 1px solid rgba(244,63,94,.2); }

.logout-btn {
  padding: 8px 18px;
  background: transparent;
  color: var(--tx-dim);
  border: 1px solid var(--bd-2);
  border-radius: var(--r-full);
  cursor: pointer;
  font-weight: 600;
  font-size: .82rem;
  transition: all .2s;
  font-family: inherit;
}
.logout-btn:hover { background: rgba(244,63,94,.08); color: var(--rose); border-color: rgba(244,63,94,.2); }

/* ═══ HERO BAND ═══ */
.hero-band {
  background: linear-gradient(135deg, #00E5FF 0%, #7C3AED 50%, #FF1744 100%);
  color: white;
  padding: 44px 40px;
  text-align: center;
  margin-bottom: 36px;
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--bd-indigo);
}
.hero-band::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 20% 50%, rgba(255,255,255,.06) 0%, transparent 50%),
              radial-gradient(ellipse at 80% 30%, rgba(0,229,255,.08) 0%, transparent 50%);
  pointer-events: none;
}
.hero-band h1 { font-size: 1.9rem; font-weight: 800; margin-bottom: 6px; position: relative; }
.hero-band p  { font-size: .95rem; opacity: .85; position: relative; }

.trial-countdown {
  display: inline-block;
  margin-top: 10px;
  padding: 5px 14px;
  background: rgba(255,255,255,.12);
  border-radius: var(--r-full);
  font-size: .82rem;
  position: relative;
  border: 1px solid rgba(255,255,255,.15);
}

/* ═══ CONTAINER ═══ */
.container { max-width: 1360px; margin: 0 auto; padding: 0 36px 48px; }

/* ═══ STATS GRID ═══ */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 24px;
  border-radius: var(--r-lg);
  border: 1px solid var(--bd-1);
  box-shadow: var(--shadow-card);
  transition: all .25s;
  position: relative;
  overflow: hidden;
}
.stat-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(124,58,237,.3), transparent);
  opacity: 0;
  transition: opacity .3s;
}
.stat-card:hover { transform: translateY(-3px); border-color: var(--bd-indigo); box-shadow: var(--shadow-card), var(--shadow-indigo); }
.stat-card:hover::after { opacity: 1; }

.stat-icon-box {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--indigo-lo);
  border: 1px solid var(--bd-indigo);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}

.stat-number {
  font-size: 1.85rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--tx-bright);
  margin-bottom: 4px;
  letter-spacing: -.02em;
}

.stat-label { color: var(--tx-dim); font-size: .82rem; font-weight: 500; }

/* ═══ CARDS ═══ */
.card {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 28px;
  border-radius: var(--r-lg);
  border: 1px solid var(--bd-1);
  box-shadow: var(--shadow-card);
  margin-bottom: 24px;
}
.card h2 {
  color: var(--tx-bright);
  margin-bottom: 18px;
  font-size: 1.1rem;
  font-weight: 700;
}

/* ═══ LAYOUT GRIDS ═══ */
.main-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; }

/* ═══ QUICK ACTIONS ═══ */
.quick-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }

.action-btn {
  padding: 20px 14px;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  color: var(--tx-body);
  border: 1px solid var(--bd-1);
  border-radius: var(--r-lg);
  cursor: pointer;
  font-weight: 600;
  font-size: .85rem;
  transition: all .2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-family: inherit;
}
.action-btn:hover {
  background: var(--raise);
  border-color: var(--bd-indigo);
  color: var(--tx-bright);
  transform: translateY(-2px);
  box-shadow: var(--shadow-indigo);
}

/* ═══ TABLES ═══ */
.data-table, .agents-table, .deals-table, .plans-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th, .agents-table th, .deals-table th {
  padding: 10px 14px;
  text-align: left;
  color: var(--tx-dim);
  font-weight: 600;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .6px;
  border-bottom: 1px solid var(--bd-2);
  background: rgba(124,58,237,.04);
}
.data-table td, .agents-table td, .deals-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--bd-1);
  font-size: .88rem;
  color: var(--tx-body);
}
.data-table tr:last-child td, .agents-table tr:last-child td, .deals-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td, .agents-table tr:hover td, .deals-table tr:hover td {
  background: rgba(124,58,237,.025);
}

/* ═══ PLANS TABLE ═══ */
.plans-table th { border-bottom: 1px solid var(--bd-1); padding: 8px 12px; color: var(--tx-dim); font-size: .72rem; text-transform: uppercase; letter-spacing: .5px; }
.plans-table td { padding: 10px 12px; border-bottom: 1px solid var(--bd-1); font-size: .88rem; }
.plans-table tr:hover { background: rgba(124,58,237,.02); }

/* ═══ BADGES ═══ */
.badge {
  padding: 3px 9px;
  border-radius: var(--r-full);
  font-size: .68rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  letter-spacing: .02em;
}
.badge-active   { background: rgba(16,185,129,.1);  color: #34d399;  border: 1px solid rgba(16,185,129,.2); }
.badge-inactive { background: rgba(100,116,139,.1); color: #64748b;  border: 1px solid rgba(100,116,139,.2); }
.badge-pending  { background: rgba(124,58,237,.1);  color: var(--indigo-hi); border: 1px solid var(--bd-indigo); }
.badge-trial    { background: rgba(245,158,11,.1);  color: #fbbf24;  border: 1px solid rgba(245,158,11,.2); }
.badge-pro      { background: var(--indigo-lo);     color: var(--indigo-hi); border: 1px solid var(--bd-indigo); }
.badge-won      { background: rgba(16,185,129,.1);  color: #34d399;  border: 1px solid rgba(16,185,129,.2); }
.badge-lost     { background: rgba(244,63,94,.1);   color: #f87171;  border: 1px solid rgba(244,63,94,.2); }
.badge-danger   { background: rgba(244,63,94,.1);   color: #f87171;  border: 1px solid rgba(244,63,94,.2); }

/* ═══ STATUS DOTS ═══ */
.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.status-dot.green  { background: #34d399; box-shadow: 0 0 5px rgba(52,211,153,.5); }
.status-dot.red    { background: #f87171; box-shadow: 0 0 5px rgba(248,113,113,.4); }
.status-dot.orange { background: #fbbf24; box-shadow: 0 0 5px rgba(251,191,36,.4); }
.status-dot.pulse  { animation: pulse-glow 2s infinite; }

/* ═══ SKELETON LOADERS ═══ */
.skeleton {
  background: linear-gradient(90deg, var(--raise) 25%, rgba(148,163,184,.05) 50%, var(--raise) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--r-sm);
}
.skeleton-text  { height: 13px; margin-bottom: 8px; }
.skeleton-title { height: 20px; margin-bottom: 12px; width: 55%; }
.skeleton-card  { height: 80px; }

/* ═══ TOOLTIP ═══ */
.tooltip-wrap { position: relative; display: inline-flex; align-items: center; }
.tooltip-icon {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: rgba(255,255,255,.05);
  color: var(--tx-dim);
  font-size: 8px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: help;
  margin-left: 5px;
  flex-shrink: 0;
  border: 1px solid var(--bd-2);
}
.tooltip-text {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--bd-2);
  border-radius: var(--r-md);
  padding: 8px 12px;
  font-size: .73rem;
  color: var(--tx-body);
  z-index: 300;
  pointer-events: none;
  min-width: 180px;
  max-width: 240px;
  white-space: normal;
  line-height: 1.5;
  box-shadow: var(--shadow-md);
}
.tooltip-text::after {
  content: '';
  position: absolute;
  top: 100%; left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--surface);
}
.tooltip-wrap:hover .tooltip-text { display: block; }

/* ═══ SIDEBAR LAYOUT ═══ */
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px;
  min-height: 100vh;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  background: var(--sidebar-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--bd-1);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow: hidden;
  transition: width .3s cubic-bezier(.4,0,.2,1);
}

/* Collapsible sidebar */
.sidebar.collapsed { width: 64px; }
.sidebar.collapsed .sidebar-label,
.sidebar.collapsed .sidebar-section-label,
.sidebar.collapsed .profile-info,
.sidebar.collapsed .wa-label,
.sidebar.collapsed .sidebar-wa-btn,
.sidebar.collapsed .sidebar-logo-text { display: none; }
.sidebar.collapsed .sidebar-header { padding: 18px 12px; justify-content: center; }
.sidebar.collapsed .sidebar-nav a,
.sidebar.collapsed .sidebar-nav button.sidebar-btn { justify-content: center; padding: 10px; }
.sidebar.collapsed .sidebar-nav-icon { margin: 0; }
.sidebar.collapsed .sidebar-footer { padding: 12px 8px; }
.sidebar.collapsed .sidebar-wa-status { justify-content: center; }
.sidebar.collapsed .sidebar-profile { justify-content: center; }
.sidebar.collapsed .collapse-btn { transform: rotate(180deg); }

/* Default hidden for elements that only show on mobile */
.sidebar-toggle { display: none; }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 199; }

.collapse-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--tx-dim);
  padding: 4px;
  border-radius: var(--r-sm);
  transition: all .2s;
  display: flex;
  align-items: center;
  margin-left: auto;
  flex-shrink: 0;
}
.collapse-btn:hover { color: var(--tx-bright); background: var(--raise); }

.main-content {
  margin-left: 240px;
  min-height: 100vh;
  flex: 1;
  transition: margin-left .3s cubic-bezier(.4,0,.2,1);
}
.main-content.expanded { margin-left: 64px; }

.sidebar-header {
  padding: 18px 14px 16px;
  border-bottom: 1px solid var(--bd-1);
  display: flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
  min-height: 60px;
}

.sidebar-logo-icon {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--indigo), var(--cyan));
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .88rem; color: white;
  flex-shrink: 0;
}
.sidebar-logo-text { font-size: 1rem; font-weight: 800; color: var(--tx-bright); }

.sidebar-nav { flex: 1; padding: 10px 8px; overflow-y: auto; }
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--bd-2); border-radius: 2px; }

.sidebar-nav a, .sidebar-nav button.sidebar-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--r-md);
  font-size: .84rem;
  color: var(--tx-dim);
  text-decoration: none;
  transition: all .15s;
  margin-bottom: 1px;
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
}
.sidebar-nav a:hover, .sidebar-nav button.sidebar-btn:hover {
  background: var(--raise);
  color: var(--tx-bright);
  text-decoration: none;
}
.sidebar-nav a.active, .sidebar-nav button.sidebar-btn.active {
  background: var(--indigo-lo);
  color: var(--indigo-hi);
  font-weight: 600;
  border: 1px solid var(--bd-indigo);
}
.sidebar-nav-icon { width: 17px; height: 17px; flex-shrink: 0; opacity: .65; }
.sidebar-nav .active .sidebar-nav-icon { opacity: 1; }

.sidebar-section-label {
  font-size: .65rem;
  font-weight: 700;
  color: var(--tx-dim);
  text-transform: uppercase;
  letter-spacing: .8px;
  padding: 10px 10px 3px;
  display: block;
  opacity: .6;
}

.sidebar-footer {
  padding: 10px 10px 14px;
  border-top: 1px solid var(--bd-1);
  flex-shrink: 0;
}

.sidebar-wa-status {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 9px;
  border-radius: var(--r-md);
  background: var(--raise);
  border: 1px solid var(--bd-1);
  font-size: .76rem;
  margin-bottom: 6px;
}
.wa-label { flex: 1; color: var(--tx-body); white-space: nowrap; overflow: hidden; }
.sidebar-wa-btn {
  padding: 2px 8px;
  border-radius: var(--r-full);
  font-size: .68rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--bd-indigo);
  background: var(--indigo-lo);
  color: var(--indigo-hi);
  font-family: inherit;
  transition: all .15s;
  flex-shrink: 0;
  white-space: nowrap;
}
.sidebar-wa-btn:hover { background: var(--indigo); color: white; }

.sidebar-profile {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background .15s;
  position: relative;
  overflow: visible;
}
.sidebar-profile:hover { background: var(--raise); }

.profile-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--indigo), var(--cyan));
  display: flex; align-items: center; justify-content: center;
  font-size: .72rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  overflow: hidden;
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-info { flex: 1; min-width: 0; overflow: hidden; }
.profile-name { font-size: .78rem; font-weight: 600; color: var(--tx-bright); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-plan { font-size: .68rem; color: var(--tx-dim); }

.profile-menu {
  display: none;
  position: absolute;
  bottom: calc(100% + 4px);
  left: 6px; right: 6px;
  background: var(--surface);
  border: 1px solid var(--bd-2);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 200;
  animation: fadeUp .15s ease;
}
.profile-menu.open { display: block; }
.profile-menu a, .profile-menu button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border-radius: var(--r-sm);
  font-size: .8rem;
  color: var(--tx-body);
  text-decoration: none;
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  transition: background .1s;
  white-space: nowrap;
}
.profile-menu a:hover, .profile-menu button:hover { background: var(--raise); color: var(--tx-bright); text-decoration: none; }
.profile-menu hr { border: none; border-top: 1px solid var(--bd-1); margin: 4px 0; }

/* Section switching */
.page-section { display: block; }
.page-section.section-hidden { display: none; }

/* ═══ PAGE FOOTER ═══ */
.page-footer {
  text-align: center;
  padding: 20px;
  font-size: .73rem;
  color: var(--tx-dim);
  border-top: 1px solid var(--bd-1);
  margin-top: 40px;
}
.page-footer a { color: var(--tx-dim); }
.page-footer a:hover { color: var(--tx-body); }

/* ═══ FORMS ═══ */
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="url"], input[type="tel"],
input[type="date"], select, textarea {
  padding: 10px 13px;
  border: 1px solid var(--bd-2);
  border-radius: var(--r-md);
  font-family: inherit;
  font-size: .88rem;
  background: var(--raise);
  color: var(--tx-bright);
  transition: all .2s;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px rgba(124,58,237,.12);
}
input::placeholder, textarea::placeholder { color: var(--tx-dim); }
select option { background: var(--surface); color: var(--tx-bright); }

/* ═══ ACCOUNT ITEMS ═══ */
.account-item {
  display: flex;
  justify-content: space-between;
  padding: 11px 0;
  border-bottom: 1px solid var(--bd-1);
}
.account-item:last-child { border: none; }
.account-label { font-weight: 600; color: var(--tx-bright); font-size: .88rem; }
.account-value { color: var(--tx-body); font-size: .88rem; }

/* ═══ EMPTY STATE ═══ */
.empty-state { text-align: center; padding: 48px 20px; color: var(--tx-dim); }
.empty-state-icon { font-size: 2.8rem; margin-bottom: 12px; opacity: .4; }
.empty-state p { font-size: .88rem; }

/* ═══ OVERLAYS ═══ */
.paywall-overlay, .consent-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  backdrop-filter: blur(8px);
  z-index: 500;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.paywall-overlay.active, .consent-overlay.active { display: flex; }
.consent-overlay { z-index: 600; }

.paywall-card, .consent-card {
  background: var(--surface);
  border-radius: var(--r-xl);
  border: 1px solid var(--bd-2);
  box-shadow: var(--shadow-lg), 0 0 40px rgba(124,58,237,.08);
  max-width: 560px;
  width: 100%;
  padding: 40px 32px;
  text-align: center;
  max-height: 90vh;
  overflow-y: auto;
  animation: fadeUp .25s ease;
}
.paywall-card h2, .consent-card h2 {
  color: var(--tx-bright);
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 10px;
}
.paywall-card > p, .consent-card > p {
  color: var(--tx-dim);
  margin-bottom: 22px;
  font-size: .92rem;
}
.paywall-icon { font-size: 3.5rem; margin-bottom: 16px; }

/* ═══ DEALS TABS ═══ */
.deals-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--bd-2);
}
.deal-tab {
  padding: 9px 18px;
  cursor: pointer;
  font-weight: 600;
  font-size: .83rem;
  color: var(--tx-dim);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all .2s;
}
.deal-tab.active { color: var(--indigo-hi); border-bottom-color: var(--indigo); }
.deal-tab:hover  { color: var(--tx-body); }
.tab-count {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 8px;
  font-size: .68rem;
  margin-left: 5px;
  background: var(--indigo-lo);
  color: var(--indigo-hi);
}

/* ═══ STATS SUMMARY ═══ */
.stats-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 20px;
  padding: 18px;
  background: var(--raise);
  border-radius: var(--r-lg);
  border: 1px solid var(--bd-1);
}
.summary-item { text-align: center; }
.summary-label { font-size: .72rem; color: var(--tx-dim); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; }
.summary-value { font-size: 1.25rem; font-weight: 700; color: var(--tx-bright); font-variant-numeric: tabular-nums; }
.summary-value.green  { color: var(--emerald); }
.summary-value.orange { color: var(--amber); }
.summary-value.red    { color: var(--rose); }

/* ═══ AGENT ═══ */
.agent-cell { display: flex; align-items: center; gap: 10px; }
.agent-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--indigo-lo);
  border: 1px solid var(--bd-indigo);
  display: flex; align-items: center; justify-content: center;
  font-size: .82rem;
  color: var(--indigo-hi);
  font-weight: 600;
}
.agents-counter { font-size: .83rem; color: var(--tx-dim); margin-bottom: 14px; }
.agents-counter strong { color: var(--indigo-hi); }

/* ═══ MIIA ACTIVE INDICATOR ═══ */
.miia-active-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 13px;
  border-radius: var(--r-full);
  background: rgba(16,185,129,.1);
  color: var(--emerald);
  font-size: .78rem;
  font-weight: 600;
  border: 1px solid rgba(16,185,129,.2);
}
.miia-active-badge .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 6px rgba(16,185,129,.5);
  animation: pulse-glow 2s infinite;
}

/* ═══ TOAST ═══ */
.toast {
  position: fixed;
  bottom: 24px; right: 24px;
  padding: 12px 18px;
  border-radius: var(--r-lg);
  font-size: .85rem;
  font-weight: 600;
  z-index: 9999;
  max-width: 360px;
  animation: fadeUp .25s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(12px);
}
.toast.success { background: rgba(16,185,129,.12); color: var(--emerald); border: 1px solid rgba(16,185,129,.25); }
.toast.error   { background: rgba(244,63,94,.12);   color: #f87171;      border: 1px solid rgba(244,63,94,.25); }
.toast.warning { background: rgba(245,158,11,.12);  color: var(--amber);  border: 1px solid rgba(245,158,11,.25); }
.toast.info    { background: var(--indigo-lo);       color: var(--indigo-hi); border: 1px solid var(--bd-indigo); }

/* ═══ MODAL ═══ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  backdrop-filter: blur(8px);
  z-index: 800;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal-card {
  background: var(--surface);
  border: 1px solid var(--bd-2);
  border-radius: var(--r-xl);
  padding: 32px;
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: fadeUp .2s ease;
}
.modal-card h3 { font-size: 1.15rem; font-weight: 700; color: var(--tx-bright); margin-bottom: 16px; }

/* ═══ SECTION HEADERS ═══ */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  gap: 16px;
}
.section-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--tx-bright);
}
.section-subtitle {
  font-size: .82rem;
  color: var(--tx-dim);
  margin-top: 2px;
}

/* ═══ THEME TOGGLE ═══ */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--r-md);
  cursor: pointer;
  background: none;
  border: 1px solid var(--bd-1);
  color: var(--tx-dim);
  font-size: .76rem;
  font-family: inherit;
  font-weight: 500;
  transition: all .2s;
  width: 100%;
  margin-bottom: 8px;
}
.theme-toggle:hover { background: var(--raise); color: var(--tx-bright); }
.theme-toggle-icon { font-size: 1rem; }

/* Smooth transition on theme change */
html.theme-transitioning,
html.theme-transitioning *,
html.theme-transitioning *::before,
html.theme-transitioning *::after {
  transition: background-color .3s ease, color .2s ease, border-color .3s ease, box-shadow .3s ease !important;
}

/* ═══ RESPONSIVE ═══ */
@media (max-width: 768px) {
  /* Sidebar: off-canvas en móvil */
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    transform: translateX(-100%);
    width: 260px !important;
    z-index: 200;
    transition: transform .3s cubic-bezier(.4,0,.2,1);
    box-shadow: 4px 0 32px rgba(0,0,0,.5);
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar.collapsed { transform: translateX(-100%); width: 260px !important; }

  /* Botón hamburguesa visible */
  .sidebar-toggle { display: flex !important; }

  /* Overlay oscuro detrás del sidebar en móvil */
  .sidebar-overlay { display: block !important; }

  /* Main content ocupa todo el ancho */
  .main-content { margin-left: 0 !important; }
  .container, .view-container { padding: 16px 14px 60px; }

  /* Ocultar collapse-btn en móvil (no tiene sentido) */
  .collapse-btn { display: none !important; }

  /* Grids → 1 columna */
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .main-grid { grid-template-columns: 1fr; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr !important; }
  .settings-grid { grid-template-columns: 1fr !important; }
  .agents-grid { grid-template-columns: 1fr !important; }
  .contacts-stats { grid-template-columns: 1fr 1fr !important; }

  /* Tablas: scroll horizontal */
  .table-wrap, .data-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 520px; }

  /* Cards y secciones */
  .card { padding: 16px; }
  .section-card { padding: 16px; }
  .modal-card { margin: 16px; padding: 24px 18px; max-width: calc(100vw - 32px) !important; }

  /* Tabs: scroll horizontal en móvil */
  .tabs, .t-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; flex-wrap: nowrap; }
  .tab-btn, .t-tab { white-space: nowrap; flex-shrink: 0; }

  /* Botones en fila → apilados */
  .btn-row { flex-direction: column; gap: 8px; }
  .btn-row .btn-primary,
  .btn-row .btn-ghost { width: 100%; }

  /* Headers de vista */
  .view-header, .page-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .view-header .btn-primary,
  .page-header .btn-primary { width: 100%; text-align: center; }

  /* Bento grid collapsa */
  .bento-grid { grid-template-columns: 1fr !important; }
  .bento-hero, .bento-md, .bento-sm, .bento-wide, .bento-full { grid-column: span 1 !important; }

  /* Training tabs: solo iconos en móvil */
  .training-tab-label { display: none; }
  .training-tab-icon { margin-right: 0; }

  /* Paywall grid */
  .paywall-plans { grid-template-columns: 1fr !important; }

  /* Pipeline bars */
  .pipeline-row { flex-direction: column; gap: 4px; }

  /* Chat bubbles */
  .chat-messages { padding: 12px; }

  /* Page footer */
  .page-footer { padding: 16px; font-size: 0.75rem; }
}

@media (max-width: 480px) {
  .stats { grid-template-columns: 1fr; }
  .contacts-stats { grid-template-columns: 1fr 1fr !important; }

  /* Topbar si existe */
  .topbar-nav .nav-label { display: none; }

  /* Inputs y botones más grandes para touch */
  input, select, textarea { font-size: 16px !important; } /* evita zoom en iOS */
  .btn-primary, .btn-ghost { padding: 12px 18px; }

  /* Modal full-width en pantallas muy chicas */
  .modal-card { margin: 8px; padding: 20px 14px; }

  /* Tabla sin min-width en pantalla muy chica */
  table { min-width: 420px; }
}
