:root {
  --bg-dark: #0a0d14;
  --bg-card: rgba(18, 24, 38, 0.75);
  --bg-card-hover: rgba(26, 34, 52, 0.85);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(59, 130, 246, 0.3);
  
  --primary-gradient: linear-gradient(135deg, #2563eb 0%, #3b82f6 50%, #06b6d4 100%);
  --bi-blue: #0033a0;
  --bi-gold: #eaaa00;
  --emerald-neon: #10b981;
  --emerald-glow: rgba(16, 185, 129, 0.25);
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --radius-full: 9999px;
  
  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.5), 0 0 1px 1px rgba(255, 255, 255, 0.05);
  --transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Modo Claro (Light Mode) */
[data-theme="light"] {
  --bg-dark: #f3f5f9;
  --bg-card: rgba(255, 255, 255, 0.92);
  --bg-card-hover: rgba(255, 255, 255, 1);
  --border-subtle: rgba(15, 23, 42, 0.09);
  --border-glow: rgba(37, 99, 235, 0.2);
  
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #64748b;
  
  --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.06), 0 0 1px 1px rgba(0, 0, 0, 0.04);
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
  position: relative;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Selector de Tema (Oscuro / Claro) */
.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.theme-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}
[data-theme="light"] .theme-toggle-btn {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.12);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}
.super-admin-tag {
  font-size: 0.65rem;
  background: rgba(234, 170, 0, 0.2);
  color: var(--bi-gold);
  border: 1px solid rgba(234, 170, 0, 0.4);
  padding: 2px 7px;
  border-radius: var(--radius-full);
  font-weight: 800;
  vertical-align: middle;
  margin-left: 8px;
}

.client-tenant-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
}
[data-theme="light"] .client-tenant-chip {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}
.chip-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald-neon);
  box-shadow: 0 0 8px var(--emerald-neon);
}

/* Pantalla de Seguridad: Acceso No Autorizado / Sin Token */
.unauthorized-screen {
  min-height: calc(100vh - 120px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  position: relative;
  z-index: 10;
}
.unauthorized-card {
  max-width: 580px;
  width: 100%;
  padding: 40px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  border: 1px solid rgba(239, 68, 68, 0.3);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5), 0 0 20px rgba(239, 68, 68, 0.15);
}
.lock-icon-badge {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  margin-bottom: 20px;
}
.unauthorized-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-main);
}
.unauthorized-desc {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 24px;
}
.security-steps-box {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  text-align: left;
  width: 100%;
  margin-bottom: 24px;
}
[data-theme="light"] .security-steps-box {
  background: rgba(0, 0, 0, 0.03);
}
.security-steps-box h4 {
  font-size: 0.88rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-main);
}
.security-steps-box ol {
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.security-footer-note {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

/* Orbs de luz ambiental de fondo */
.bg-glow-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.15;
}
.orb-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #3b82f6 0%, #1d4ed8 70%);
  top: -100px;
  right: -50px;
}
.orb-2 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, #10b981 0%, #047857 70%);
  bottom: -150px;
  left: -100px;
}

/* Glassmorphism Container */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.glass-card:hover {
  border-color: rgba(255, 255, 255, 0.14);
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10, 13, 20, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 16px 32px;
}
.header-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.logo-group {
  display: flex;
  align-items: center;
  gap: 14px;
}
.logo-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
}
.logo-title {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.logo-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}
.tenant-selector-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  padding: 6px 14px;
  border-radius: var(--radius-full);
}
.tenant-selector-pill .label {
  font-size: 0.78rem;
  color: var(--text-muted);
}
.styled-select {
  background: transparent;
  color: var(--text-main);
  border: none;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
}
.styled-select option {
  background: #111827;
  color: white;
}

.gateway-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 51, 160, 0.25);
  border: 1px solid rgba(0, 51, 160, 0.4);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
  color: #93c5fd;
}
.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald-neon);
  box-shadow: 0 0 10px var(--emerald-neon);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

/* Layout Principal */
.main-container {
  max-width: 1400px;
  margin: 32px auto;
  padding: 0 32px 64px;
  position: relative;
  z-index: 1;
}

/* Métricas Grid (Fila 1) */
.metrics-grid {
  display: grid;
  grid-template-columns: 1.4fr 1.1fr 1fr;
  gap: 24px;
  margin-bottom: 36px;
}

/* Tarjeta 1: Balance de Créditos */
.balance-card {
  padding: 28px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}
.card-eyebrow {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  font-weight: 600;
  display: block;
}
.card-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.status-chip {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-full);
}
.status-chip.active {
  background: rgba(16, 185, 129, 0.15);
  color: var(--emerald-neon);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.balance-number-group {
  margin-bottom: 20px;
}
.large-number {
  font-family: var(--font-mono);
  font-size: 3.2rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
  background: linear-gradient(135deg, #ffffff 30%, #93c5fd 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}
.balance-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
  color: var(--text-muted);
}
.consumption-rate {
  font-weight: 600;
  color: #38bdf8;
}

.progress-bar-container {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 24px;
}
.progress-bar-fill {
  height: 100%;
  background: var(--primary-gradient);
  border-radius: var(--radius-full);
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.5);
}

.card-footer-action {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 18px;
  border-top: 1px solid var(--border-subtle);
}
.renewal-note {
  font-size: 0.82rem;
  color: var(--text-dim);
}

/* Tarjeta 2: Plan */
.plan-card {
  padding: 28px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.plan-price-tag {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
  padding: 4px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}
.plan-description {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.plan-features-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}
.feature-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: #cbd5e1;
}
.check-icon {
  color: var(--emerald-neon);
  font-weight: bold;
}

/* Tarjeta 3: Bóveda de Tarjeta */
.card-vault-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.pci-badge {
  font-size: 0.68rem;
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-weight: 700;
}
.virtual-card {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 18px 20px;
  position: relative;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4);
  margin: 12px 0 16px;
}
.card-chip {
  width: 32px;
  height: 24px;
  background: linear-gradient(135deg, #d4af37 0%, #aa771c 100%);
  border-radius: 4px;
  margin-bottom: 16px;
}
.card-bi-logo {
  position: absolute;
  top: 16px;
  right: 18px;
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: 1.1rem;
  color: #60a5fa;
}
.card-number-masked {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  letter-spacing: 0.18em;
  margin-bottom: 16px;
  color: #f1f5f9;
}
.card-bottom {
  display: flex;
  justify-content: space-between;
}
.holder-label {
  display: block;
  font-size: 0.62rem;
  color: var(--text-dim);
  letter-spacing: 0.05em;
}
.holder-name, .expiry-date {
  font-size: 0.82rem;
  font-weight: 600;
  color: #cbd5e1;
}
.vault-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
}
.token-hash {
  font-family: var(--font-mono);
  color: var(--text-dim);
}

/* Botones */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  font-family: var(--font-sans);
}
.btn-primary {
  background: var(--primary-gradient);
  color: white;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.5);
}
.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
}
.btn-full {
  width: 100%;
}
.btn-link {
  background: transparent;
  color: #60a5fa;
  border: none;
  cursor: pointer;
  font-size: 0.8rem;
  text-decoration: underline;
}

/* Sección de Distribución y Registro Dinámico de Agentes */
.dynamic-agents-section {
  margin-bottom: 36px;
}
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 20px;
}
.section-title {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.section-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
}
.quick-sim-badge {
  font-size: 0.8rem;
  background: rgba(234, 170, 0, 0.15);
  color: var(--bi-gold);
  border: 1px solid rgba(234, 170, 0, 0.3);
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-weight: 600;
}

.dynamic-agents-grid {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 20px;
  margin-bottom: 20px;
}

/* Gráfico Dinámico (Donut Chart) */
.chart-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
}
.chart-card-title {
  font-size: 1.1rem;
  font-weight: 700;
}
.badge-total-ops, .agent-count-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.25);
}
.chart-content {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-top: 16px;
  flex: 1;
}
.chart-donut-wrapper {
  position: relative;
  width: 170px;
  height: 170px;
  flex-shrink: 0;
}
.donut-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.donut-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.06);
  stroke-width: 14;
}
[data-theme="light"] .donut-bg {
  stroke: rgba(0, 0, 0, 0.06);
}
.donut-segment {
  fill: none;
  stroke-width: 14;
  transition: stroke-dasharray 0.6s cubic-bezier(0.16, 1, 0.3, 1), stroke-dashoffset 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.donut-center-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}
.donut-center-number {
  display: block;
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--text-main);
}
.donut-center-sub {
  font-size: 0.68rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.chart-legend {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  max-height: 170px;
  overflow-y: auto;
}
.legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
}
.legend-left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.legend-name {
  font-weight: 600;
  color: var(--text-main);
}
.legend-pct {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-muted);
}
.legend-empty {
  font-size: 0.82rem;
  color: var(--text-dim);
  font-style: italic;
}

/* Lista / Registro Dinámico de Agentes */
.agents-breakdown-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
}
.agents-dynamic-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
  max-height: 200px;
  overflow-y: auto;
  padding-right: 4px;
}
.dynamic-agent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: var(--transition);
}
.dynamic-agent-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
}
[data-theme="light"] .dynamic-agent-item {
  background: rgba(0, 0, 0, 0.02);
}
[data-theme="light"] .dynamic-agent-item:hover {
  background: rgba(0, 0, 0, 0.04);
}
.agent-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.agent-item-icon {
  font-size: 1.3rem;
}
.agent-item-title {
  font-size: 0.92rem;
  font-weight: 700;
}
.agent-item-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
}
.agent-item-right {
  display: flex;
  align-items: center;
  gap: 14px;
}
.agent-item-credits {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 700;
  color: #38bdf8;
}
.agent-ops-pill {
  font-size: 0.72rem;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-dim);
  padding: 3px 8px;
  border-radius: var(--radius-full);
}
.empty-agents-state {
  text-align: center;
  padding: 28px 16px;
  color: var(--text-dim);
}
.empty-agents-state .empty-icon {
  font-size: 2.2rem;
  display: block;
  margin-bottom: 8px;
  opacity: 0.7;
}
.empty-agents-state .empty-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: block;
  margin-top: 4px;
}

/* Simulador Universal de Agentes */
.universal-simulator-card {
  padding: 22px 28px;
  margin-top: 20px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08) 0%, rgba(18, 24, 38, 0.8) 100%);
}
[data-theme="light"] .universal-simulator-card {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.06) 0%, rgba(255, 255, 255, 0.95) 100%);
}
.sim-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}
.sim-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: rgba(234, 170, 0, 0.2);
  color: var(--bi-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}
.sim-title {
  font-size: 1.05rem;
  font-weight: 700;
}
.sim-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.sim-form {
  display: flex;
  gap: 14px;
  align-items: flex-end;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-group.flex-1 { flex: 1; }
.form-group.flex-2 { flex: 2; }
.form-group.flex-3 { flex: 3; }
.form-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.styled-input {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  outline: none;
  transition: var(--transition);
  width: 100%;
}
.styled-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}
[data-theme="light"] .styled-input {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.12);
  color: #0f172a;
}
.sim-button-group {
  flex-shrink: 0;
}

@media (max-width: 1024px) {
  .dynamic-agents-grid {
    grid-template-columns: 1fr;
  }
  .sim-form {
    flex-direction: column;
    align-items: stretch;
  }
}

/* Sección de Bitácora / Tabla */
.ledger-section {
  margin-bottom: 40px;
}
.ledger-table-card {
  padding: 0;
  overflow: hidden;
}
.table-responsive {
  overflow-x: auto;
}
.ledger-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
.ledger-table th {
  background: rgba(255, 255, 255, 0.03);
  padding: 14px 20px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border-subtle);
}
.ledger-table td {
  padding: 14px 20px;
  font-size: 0.88rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.ledger-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}
.badge-agent {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
}
.movement-deduction {
  font-family: var(--font-mono);
  font-weight: 700;
  color: #f87171;
}
.movement-addition {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--emerald-neon);
}
.balance-result {
  font-family: var(--font-mono);
  color: var(--text-muted);
}
.empty-state {
  text-align: center;
  color: var(--text-dim);
  padding: 32px !important;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(12px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.open {
  display: flex;
}
.modal-dialog {
  max-width: 520px;
  width: 100%;
  padding: 32px;
  background: #111827;
  border: 1px solid rgba(255, 255, 255, 0.15);
  animation: modalEnter 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes modalEnter {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.modal-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
}
.modal-icon-badge {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: rgba(234, 170, 0, 0.2);
  color: var(--bi-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}
.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
}
.modal-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
}
.btn-close {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 1.8rem;
  cursor: pointer;
  margin-left: auto;
  line-height: 1;
}

.packages-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}
.package-option {
  padding: 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: var(--transition);
}
.package-option:hover {
  background: rgba(255, 255, 255, 0.07);
}
.package-option.selected {
  border-color: #3b82f6;
  background: rgba(37, 99, 235, 0.15);
  box-shadow: 0 0 16px rgba(37, 99, 235, 0.25);
}
.pkg-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  margin-bottom: 4px;
}
.pkg-price {
  font-family: var(--font-mono);
  color: #38bdf8;
}
.pkg-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
}
.badge-popular {
  font-size: 0.65rem;
  background: var(--bi-gold);
  color: black;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  margin-left: 6px;
}

.charge-summary-box {
  background: rgba(0, 0, 0, 0.3);
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
}
.summary-row {
  display: flex;
  justify-content: space-between;
}
.text-success {
  color: var(--emerald-neon);
  font-weight: 600;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  background: #1e293b;
  color: white;
  border: 1px solid var(--border-subtle);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes toastIn {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@media (max-width: 1024px) {
  .metrics-grid {
    grid-template-columns: 1fr;
  }
}
