:root {
  --bg-primary: #0a0a0a;
  --bg-surface: #111111;
  --bg-card: #141414;
  --bg-hover: #1a1a1a;
  --bg-input: #0d0d0d;
  --border: #2a2a2a;
  --border-hover: #3a3a3a;
  --border-focus: #39ff14;
  --neon-green: #39ff14;
  --neon-green-hover: #4fff3a;
  --neon-green-dark: #2a8a0a;
  --neon-green-glow: rgba(57, 255, 20, 0.3);
  --text-white: #ffffff;
  --text-light: #c0c0c0;
  --text-muted: #888888;
  --text-dark: #555555;
  --error: #ff3333;
  --error-glow: rgba(255, 51, 51, 0.3);
  --warning: #ffaa00;
  --info: #00ccff;
  --pkg-start: #ffaa00;
  --pkg-trader: #00ccff;
  --pkg-premium: #39ff14;
  --pkg-admin: #ff3333;
  --transition-fast: 0.15s ease;
  --transition-medium: 0.25s ease;
}

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

html, body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg-primary);
  color: var(--text-light);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ============================================================
   SCROLLBAR
============================================================ */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--neon-green); }

/* ============================================================
   TIPOGRAFIA
============================================================ */
h1, h2, h3, h4, h5, h6 { color: var(--text-white); font-weight: 600; }
h1 { font-size: 28px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }

a { color: var(--neon-green); text-decoration: none; transition: var(--transition-fast); }
a:hover { color: var(--neon-green-hover); text-shadow: 0 0 8px var(--neon-green-glow); }

/* ============================================================
   BOTONES
============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 24px; border-radius: 6px; font-size: 14px; font-weight: 600;
  cursor: pointer; border: none; transition: var(--transition-fast);
  outline: none; position: relative; overflow: hidden;
  letter-spacing: 0.3px; white-space: nowrap;
}
.btn:focus-visible { outline: 2px solid var(--neon-green); outline-offset: 2px; }

.btn-primary {
  background: var(--neon-green); color: var(--bg-primary);
  box-shadow: 0 0 12px rgba(57, 255, 20, 0.2);
}
.btn-primary:hover {
  background: var(--neon-green-hover);
  box-shadow: 0 0 20px rgba(57, 255, 20, 0.4), 0 0 40px rgba(57, 255, 20, 0.15);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); box-shadow: 0 0 8px rgba(57, 255, 20, 0.3); }

.btn-secondary {
  background: transparent; color: var(--text-light);
  border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--neon-green); color: var(--neon-green); }

.btn-danger {
  background: transparent; color: var(--error); border: 1px solid var(--error);
}
.btn-danger:hover { background: var(--error); color: var(--text-white); box-shadow: 0 0 12px var(--error-glow); }

.btn-small { padding: 6px 14px; font-size: 12px; }
.btn-large { padding: 14px 32px; font-size: 16px; }

/* ============================================================
   INPUTS
============================================================ */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--text-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px;
}
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 12px 14px; background: var(--bg-input);
  border: 1px solid var(--border); border-radius: 6px;
  color: var(--text-white); font-size: 14px; transition: var(--transition-fast);
  outline: none; font-family: inherit;
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-dark); }
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--neon-green);
  box-shadow: 0 0 0 3px rgba(57, 255, 20, 0.1), 0 0 12px rgba(57, 255, 20, 0.08);
}

.form-input.ng-invalid, .form-input.error { border-color: var(--error); }

/* ============================================================
   TARJETAS (CARDS)
============================================================ */
.card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px;
  padding: 24px; transition: var(--transition-medium);
}
.card:hover { border-color: var(--border-hover); }
.card-glow {
  border: 1px solid var(--neon-green);
  box-shadow: 0 0 16px rgba(57, 255, 20, 0.1), inset 0 0 20px rgba(57, 255, 20, 0.03);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid var(--border);
}
.card-title { font-size: 16px; font-weight: 600; color: var(--text-white); }

/* ============================================================
   TABLAS
============================================================ */
.data-table { width: 100%; border-collapse: collapse; }
.data-table thead th {
  background: var(--bg-surface); color: var(--text-muted); font-size: 11px;
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;
  padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border);
}
.data-table tbody tr {
  border-bottom: 1px solid var(--border); transition: var(--transition-fast);
}
.data-table tbody tr:nth-child(even) { background: rgba(255,255,255,0.01); }
.data-table tbody tr:hover { background: var(--bg-hover); }
.data-table tbody td { padding: 14px 16px; font-size: 13px; color: var(--text-light); vertical-align: middle; }
.data-table tbody tr:focus-visible, .data-table tbody tr.focused {
  background: rgba(57, 255, 20, 0.05);
  outline: 1px solid var(--neon-green); outline-offset: -1px;
}

/* ============================================================
   BADGES / ETIQUETAS
============================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 600;
}
.badge-green { background: rgba(57, 255, 20, 0.12); color: var(--neon-green); }
.badge-red { background: rgba(255, 51, 51, 0.12); color: var(--error); }
.badge-orange { background: rgba(255, 170, 0, 0.12); color: var(--warning); }
.badge-cyan { background: rgba(0, 204, 255, 0.12); color: var(--info); }
.badge-gray { background: var(--bg-hover); color: var(--text-muted); }

/* ============================================================
   PAQUETES COLORES
============================================================ */
.pkg-start { color: var(--pkg-start); }
.pkg-trader { color: var(--pkg-trader); }
.pkg-premium { color: var(--pkg-premium); }
.pkg-admin { color: var(--pkg-admin); }

.badge-start { background: rgba(255, 170, 0, 0.15); color: var(--pkg-start); border: 1px solid rgba(255, 170, 0, 0.3); }
.badge-trader { background: rgba(0, 204, 255, 0.15); color: var(--pkg-trader); border: 1px solid rgba(0, 204, 255, 0.3); }
.badge-premium { background: rgba(57, 255, 20, 0.15); color: var(--pkg-premium); border: 1px solid rgba(57, 255, 20, 0.3); }
.badge-admin { background: rgba(255, 51, 51, 0.15); color: var(--pkg-admin); border: 1px solid rgba(255, 51, 51, 0.3); }

/* ============================================================
   SIDEBAR LAYOUT
============================================================ */
.layout-sidebar {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: 220px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  height: 100vh;
  position: fixed;
  left: 0; top: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.3s ease;
}
.sidebar-brand {
  padding: 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-white);
}
.sidebar-brand .neon-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--neon-green);
  box-shadow: 0 0 8px var(--neon-green), 0 0 16px rgba(57, 255, 20, 0.5);
  animation: pulse 2s ease-in-out infinite;
}
.sidebar-brand .sidebar-logo {
  width: 100%;
  max-height: 48px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 0 3px rgba(57, 255, 20, 0.35))
          drop-shadow(0 0 7px rgba(57, 255, 20, 0.2))
          drop-shadow(0 0 14px rgba(57, 255, 20, 0.1));
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.1); }
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.sidebar-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; margin: 2px 10px;
  border-radius: 8px; color: var(--text-muted); font-size: 13px; font-weight: 500;
  transition: var(--transition-fast); border: 1px solid transparent;
  text-decoration: none;
}
.sidebar-item:hover, .sidebar-item:focus-visible { color: var(--text-white); background: var(--bg-hover); border-color: var(--border); }
.sidebar-item.active { color: var(--neon-green); background: rgba(57, 255, 20, 0.08); border-color: rgba(57, 255, 20, 0.2); }
.sidebar-item .icon { font-size: 18px; width: 22px; text-align: center; }

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-dark);
}

.sidebar-toggle {
  display: none;
  position: fixed;
  top: 14px; left: 14px;
  z-index: 110;
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--neon-green);
  font-size: 20px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.main-content {
  flex: 1;
  min-width: 0;
  margin-left: 220px;
  padding: 28px;
  min-height: 100vh;
  transition: margin-left 0.3s ease;
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; padding: 16px; padding-top: 60px; }
  .sidebar-toggle { display: flex; }
  .sidebar-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 90;
    opacity: 0; visibility: hidden; transition: var(--transition-medium);
  }
  .sidebar-overlay.active { opacity: 1; visibility: visible; }
}

/* ============================================================
   TABS
============================================================ */
.tabs-nav {
  display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px;
}
.tab-btn {
  padding: 10px 20px; background: transparent; border: none; border-bottom: 2px solid transparent;
  color: var(--text-muted); font-size: 13px; font-weight: 600; cursor: pointer;
  transition: var(--transition-fast); margin-bottom: -1px;
}
.tab-btn:hover { color: var(--text-white); }
.tab-btn.active { color: var(--neon-green); border-bottom-color: var(--neon-green); }

.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeInUp 0.3s ease forwards; }
.alert {
  padding: 14px 18px; border-radius: 8px; font-size: 13px; font-weight: 500;
  margin-bottom: 20px; display: flex; align-items: center; gap: 10px;
  border: 1px solid;
}
.alert-success { background: rgba(57, 255, 20, 0.08); color: var(--neon-green); border-color: rgba(57, 255, 20, 0.3); }
.alert-error { background: rgba(255, 51, 51, 0.08); color: var(--error); border-color: rgba(255, 51, 51, 0.3); }
.alert-warning { background: rgba(255, 170, 0, 0.08); color: var(--warning); border-color: rgba(255, 170, 0, 0.3); }
.alert-info { background: rgba(0, 204, 255, 0.08); color: var(--info); border-color: rgba(0, 204, 255, 0.3); }

/* ============================================================
   MODAL
============================================================ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.85);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
  opacity: 0; visibility: hidden; transition: var(--transition-medium);
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal {
  background: var(--bg-card); border: 1px solid var(--neon-green);
  border-radius: 12px; padding: 28px; width: 90%; max-width: 480px;
  box-shadow: 0 0 40px rgba(57, 255, 20, 0.1), 0 20px 60px rgba(0,0,0,0.5);
  transform: translateY(20px) scale(0.98); transition: var(--transition-medium);
}
.modal-overlay.active .modal { transform: translateY(0) scale(1); }
.modal-header { margin-bottom: 20px; }
.modal-title { font-size: 18px; font-weight: 600; color: var(--text-white); }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }

/* ============================================================
   LAYOUT
============================================================ */
.container { max-width: 1280px; margin: 0 auto; padding: 0; }
.page { padding: 28px 0; }
.page-header { margin-bottom: 28px; }
.page-header h1 { margin-bottom: 4px; }
.page-header p { color: var(--text-muted); font-size: 14px; }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }
.grid-6 { grid-template-columns: repeat(6, 1fr); }

.flex { display: flex; align-items: center; }
.flex-between { justify-content: space-between; }
.flex-col { flex-direction: column; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }

.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }

/* ============================================================
   STAT CARDS
============================================================ */
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px;
  padding: 20px; display: flex; flex-direction: column; gap: 8px;
  transition: var(--transition-medium); position: relative; overflow: hidden;
}
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: var(--neon-green); opacity: 0; transition: var(--transition-medium);
}
.stat-card:hover::before { opacity: 1; }
.stat-card:hover { border-color: var(--border-hover); transform: translateY(-2px); }
.stat-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 32px; font-weight: 700; color: var(--text-white); line-height: 1; }
.stat-value.neon { color: var(--neon-green); text-shadow: 0 0 16px rgba(57, 255, 20, 0.3); }
.stat-delta { font-size: 12px; color: var(--neon-green); font-weight: 500; }


@media (max-width: 1024px) {
  .grid-4, .grid-5, .grid-6 { grid-template-columns: repeat(2, 1fr); }
  .sidebar { transform: translateX(-240px); }
  .sidebar.open { transform: translateX(0); }
}
@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4, .grid-5, .grid-6 { grid-template-columns: 1fr; }
  .page { padding: 16px 0; }
  .container { padding: 0 16px; }
}

/* ============================================================
   UTILIDADES
============================================================ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-neon { color: var(--neon-green); }
.text-muted { color: var(--text-muted); }
.text-white { color: var(--text-white); }
.text-small { font-size: 12px; }
.text-bold { font-weight: 600; }

.w-full { width: 100%; }
.hidden { display: none !important; }

/* Animacion de entrada */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-in { animation: fadeInUp 0.4s ease forwards; }

/* Divider neon */
.neon-divider {
  height: 1px; background: linear-gradient(90deg, transparent, var(--neon-green), transparent);
  opacity: 0.4; margin: 20px 0;
}

/* ============================================================
   TABLE SCROLL
============================================================ */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll::-webkit-scrollbar { height: 6px; }
.table-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.table-scroll::-webkit-scrollbar-thumb:hover { background: var(--neon-green); }

/* ============================================================
   RESPONSIVE MEJORADO
============================================================ */
@media (max-width: 1024px) {
  .grid-4, .grid-5, .grid-6 { grid-template-columns: repeat(2, 1fr); }
  .sidebar { transform: translateX(-240px); }
  .sidebar.open { transform: translateX(0); }
}
@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4, .grid-5, .grid-6 { grid-template-columns: 1fr; }
  .page { padding: 12px 0; }
  .container { padding: 0 10px; }
  .stat-value { font-size: 22px; }
  h1 { font-size: 18px; }
  .card { padding: 14px; }
  .tree-table td { padding: 10px 8px; font-size: 12px; }
}
@media (max-width: 480px) {
  .btn { padding: 8px 14px; font-size: 12px; }
  .tree-table { min-width: 680px !important; }
}
