/**
 * Once Studio - Sistema de Gestión Integral
 * styles.css - Hoja de estilos premium (Mobile-First, Dark Theme & Glassmorphism)
 */

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

/* --- Variables de Diseño (Tokens) --- */
:root {
  --font-family: 'Outfit', sans-serif;
  
  /* Paleta de Colores */
  --bg-primary: #0a0c10;
  --bg-secondary: #121620;
  --bg-card: rgba(22, 28, 45, 0.7);
  --bg-card-hover: rgba(30, 38, 60, 0.85);
  
  --color-gold: #d4af37;
  --color-gold-hover: #e5c158;
  --color-gold-glow: rgba(212, 175, 55, 0.15);
  
  --color-success: #2ec4b6;
  --color-success-bg: rgba(46, 196, 182, 0.1);
  --color-danger: #e71d36;
  --color-danger-bg: rgba(231, 29, 54, 0.1);
  --color-warning: #ff9f1c;
  --color-warning-bg: rgba(255, 159, 28, 0.1);
  --color-info: #00b4d8;
  --color-info-bg: rgba(0, 180, 216, 0.1);
  --color-purple: #9d4edd;
  --color-purple-bg: rgba(157, 78, 221, 0.1);
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --border-color: rgba(255, 255, 255, 0.08);
  --border-color-focus: rgba(212, 175, 55, 0.4);
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.7), 0 10px 10px -5px rgba(0, 0, 0, 0.7);
  --shadow-glow: 0 0 15px rgba(212, 175, 55, 0.25);
  
  --border-radius-sm: 8px;
  --border-radius-md: 16px;
  --border-radius-lg: 24px;
  --border-radius-pill: 9999px;
  
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* --- Reseteo Estándar --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(75px + var(--safe-bottom)); /* Espacio para barra de navegación móvil */
  overflow-x: hidden;
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--text-primary);
}

a {
  color: inherit;
  text-decoration: none;
}

/* --- Contenedor Principal App --- */
.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
}

/* --- Cabecera --- */
header.app-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 20px;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background-color: var(--color-gold);
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: var(--bg-primary);
  box-shadow: var(--shadow-glow);
}

.logo-text {
  font-size: 1.25rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 700;
}

.logo-text span {
  color: var(--color-gold);
}

/* --- RBAC Selector (Widget de Simulación) --- */
.user-switch-widget {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-pill);
  padding: 4px;
  display: flex;
  gap: 4px;
}

.switch-btn {
  background: transparent;
  border: none;
  padding: 6px 14px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: var(--border-radius-pill);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.switch-btn.active {
  background: var(--color-gold);
  color: var(--bg-primary);
  box-shadow: var(--shadow-sm);
}

/* --- Filtros / Selectores de Sede --- */
.branch-selector-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none; /* Firefox */
}

.branch-selector-bar::-webkit-scrollbar {
  display: none; /* Safari/Chrome */
}

.branch-pill {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 8px 16px;
  border-radius: var(--border-radius-pill);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.branch-pill.active {
  border-color: var(--color-gold);
  background: var(--color-gold-glow);
  color: var(--color-gold);
}

/* --- Tarjetas Financieras (KPIs) --- */
.kpi-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

@media(min-width: 480px) {
  .kpi-container {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media(min-width: 768px) {
  .kpi-container {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media(min-width: 1024px) {
  .kpi-container {
    grid-template-columns: repeat(5, 1fr);
  }
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
}

.kpi-card:hover {
  transform: translateY(-2px);
  background: var(--bg-card-hover);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.kpi-card:active {
  transform: translateY(0);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--text-muted);
}

.kpi-card.kpi-principal::before {
  background: var(--color-gold);
}

.kpi-card.kpi-success::before {
  background: var(--color-success);
}

.kpi-card.kpi-danger::before {
  background: var(--color-danger);
}

.kpi-card.kpi-warning::before {
  background: var(--color-warning);
}

.kpi-card.kpi-info::before {
  background: var(--color-info);
}

.kpi-card.kpi-bank::before {
  background: var(--color-purple);
}

.kpi-detail-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--color-gold);
  background: var(--color-gold-glow);
  padding: 2px 6px;
  border-radius: 4px;
  opacity: 0.5;
  transition: opacity var(--transition-fast);
}

.kpi-card:hover .kpi-detail-badge {
  opacity: 1;
}

.kpi-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-secondary);
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

.kpi-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.kpi-subvalue {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* --- Grid de Contenido (Dashboards y Formularios) --- */
.content-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

@media(min-width: 768px) {
  .content-grid {
    grid-template-columns: 2fr 1fr;
  }
  .content-grid.equal-cols {
    grid-template-columns: 1fr 1fr;
  }
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 20px;
  backdrop-filter: blur(8px);
}

.card-title {
  font-size: 1.1rem;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  padding-bottom: 10px;
}

.card-action-btn {
  background: none;
  border: none;
  color: var(--color-gold);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

/* --- Listas y Tablas de Transacciones --- */
.transaction-list-wrapper {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tx-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all var(--transition-fast);
}

.tx-item:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.15);
}

.tx-item-left {
  display: flex;
  gap: 12px;
  align-items: center;
}

.tx-icon-badge {
  width: 40px;
  height: 40px;
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.tx-icon-badge.ingreso {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.tx-icon-badge.gasto {
  background: var(--color-danger-bg);
  color: var(--color-danger);
}

.tx-icon-badge.pago-artista {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}

.tx-details {
  display: flex;
  flex-direction: column;
}

.tx-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.tx-meta {
  font-size: 0.75rem;
  color: var(--text-secondary);
  display: flex;
  gap: 8px;
  margin-top: 2px;
}

.tx-item-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.tx-amount {
  font-weight: 700;
  font-size: 1.1rem;
}

.tx-amount.ingreso {
  color: var(--color-success);
}

.tx-amount.gasto {
  color: var(--color-danger);
}

.tx-amount.pago-artista {
  color: var(--color-warning);
}

.tx-status-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
}

.tx-status-badge.pagado, .tx-status-badge.finalizado {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.tx-status-badge.pendiente, .tx-status-badge.señal {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}

.tx-status-badge.anulado {
  background: var(--color-danger-bg);
  color: var(--color-danger);
  text-decoration: line-through;
}

.tx-status-badge.pendiente_aprobacion {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: 1px dashed rgba(255, 255, 255, 0.25);
  animation: pulse-border 1.5s infinite;
}

@keyframes pulse-border {
  0% { opacity: 0.6; }
  50% { opacity: 1; }
  100% { opacity: 0.6; }
}

.tx-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.action-link {
  font-size: 0.75rem;
  color: var(--color-gold);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
}

.action-link.danger {
  color: var(--color-danger);
}

/* --- Botón Flotante de Acción (+) --- */
.floating-action-container {
  position: fixed;
  bottom: calc(75px + var(--safe-bottom) + 16px); /* Arriba de la barra de menú móvil */
  right: 16px;
  z-index: 99;
}

.btn-floating-add {
  width: 56px;
  height: 56px;
  border-radius: var(--border-radius-pill);
  background: var(--color-gold);
  color: var(--bg-primary);
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4);
  transition: transform var(--transition-fast), background var(--transition-fast);
}

.btn-floating-add:active, .btn-floating-add.active {
  transform: rotate(45deg) scale(0.9);
  background: var(--color-gold-hover);
}

.floating-menu {
  position: absolute;
  bottom: 68px;
  right: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(10px) scale(0.9);
  transition: all var(--transition-normal);
}

.floating-menu.active {
  pointer-events: auto;
  opacity: 1;
  transform: translateY(0) scale(1);
}

.floating-menu-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 10px 18px;
  border-radius: var(--border-radius-pill);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-md);
  transition: background var(--transition-fast);
}

.floating-menu-btn:hover {
  background: var(--bg-card-hover);
}

.floating-menu-btn.btn-ingreso i {
  color: var(--color-success);
}

.floating-menu-btn.btn-gasto i {
  color: var(--color-danger);
}

/* --- Botones Comunes --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  border: none;
  transition: all var(--transition-fast);
}

.btn-primary {
  background: var(--color-gold);
  color: var(--bg-primary);
}

.btn-primary:hover {
  background: var(--color-gold-hover);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn-full {
  width: 100%;
}

/* --- Formularios y Entradas --- */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 12px;
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 0.95rem;
  transition: border-color var(--transition-fast);
}

.form-control:focus {
  outline: none;
  border-color: var(--color-gold);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.calc-breakdown {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 12px;
  margin: 14px 0;
  font-size: 0.85rem;
}

.calc-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}

.calc-row:last-child {
  margin-bottom: 0;
  padding-top: 6px;
  border-top: 1px dashed var(--border-color);
  font-weight: 700;
  color: var(--color-gold);
}

/* --- Modales y Hojas Inferiores (Bottom Sheets) --- */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  max-height: 85vh;
  background: var(--bg-secondary);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  border-top-left-radius: var(--border-radius-lg);
  border-top-right-radius: var(--border-radius-lg);
  z-index: 1001;
  transform: translateY(100%);
  transition: transform var(--transition-normal);
  display: flex;
  flex-direction: column;
}

.bottom-sheet.active {
  transform: translateY(0);
}

.bottom-sheet-drag-handle {
  width: 40px;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  margin: 8px auto;
  cursor: pointer;
}

.bottom-sheet-header {
  padding: 10px 20px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
}

.bottom-sheet-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
}

.bottom-sheet-content {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  padding-bottom: calc(30px + var(--safe-bottom));
}

@media(min-width: 768px) {
  /* En pantallas grandes, las bottom sheets actúan como modales normales */
  .bottom-sheet {
    max-width: 500px;
    bottom: auto;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -40%) scale(0.95);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-lg);
    max-height: 80vh;
    border: 1px solid var(--border-color);
    opacity: 0;
    pointer-events: none;
  }
  .bottom-sheet.active {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    pointer-events: auto;
  }
  .bottom-sheet-drag-handle {
    display: none;
  }
}

/* --- OCR Scanner (Simulación) --- */
.ocr-scanner-box {
  width: 100%;
  height: 180px;
  border: 2px dashed rgba(212, 175, 55, 0.4);
  border-radius: var(--border-radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  background: rgba(212, 175, 55, 0.02);
  transition: all var(--transition-fast);
}

.ocr-scanner-box:hover {
  border-color: var(--color-gold);
  background: rgba(212, 175, 55, 0.05);
}

.ocr-scanner-line {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--color-gold);
  box-shadow: 0 0 10px var(--color-gold);
  opacity: 0;
  pointer-events: none;
}

.ocr-scanner-box.scanning .ocr-scanner-line {
  opacity: 1;
  animation: scan-anim 2s linear infinite;
}

@keyframes scan-anim {
  0% { top: 0%; }
  50% { top: 100%; }
  100% { top: 0%; }
}

.ocr-mock-receipts {
  margin-top: 14px;
}

.ocr-mock-receipt-btn {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.75rem;
  padding: 6px 12px;
  border-radius: var(--border-radius-pill);
  margin-right: 6px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.ocr-mock-receipt-btn:hover {
  border-color: var(--color-gold);
  color: var(--color-gold);
}

/* --- Alertas de Aprobación Pendiente --- */
.approval-alert-card {
  background: rgba(255, 159, 28, 0.08);
  border: 1px solid var(--color-warning);
  border-radius: var(--border-radius-md);
  padding: 16px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.approval-actions {
  display: flex;
  gap: 8px;
}

/* --- Gráfico SVG Sencillo / Barra de Progreso --- */
.progress-bar-container {
  background: rgba(255,255,255,0.05);
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  margin: 10px 0;
}

.progress-bar-fill {
  height: 100%;
  background: var(--color-gold);
  border-radius: 4px;
  width: 0%;
  transition: width var(--transition-normal);
}

.bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* --- Menú de Navegación Inferior (Sticky Mobile Nav) --- */
.mobile-nav-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: calc(60px + var(--safe-bottom));
  background: rgba(18, 22, 32, 0.95);
  backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding-bottom: var(--safe-bottom);
  z-index: 98;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  gap: 4px;
  cursor: pointer;
  flex: 1;
  height: 100%;
  transition: color var(--transition-fast);
}

.nav-item i {
  font-size: 1.25rem;
}

.nav-item.active {
  color: var(--color-gold);
}

/* --- Secciones de Pantalla --- */
.app-section {
  display: none;
}

.app-section.active {
  display: block;
  animation: fade-in 0.25s ease;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Vista de Artistas (Cuenta Corriente) --- */
.artist-card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media(min-width: 600px) {
  .artist-card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.artist-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.artist-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.artist-name {
  font-size: 1.1rem;
  font-weight: 600;
}

.artist-meta {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.artist-stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

.artist-stat-row:last-child {
  border-bottom: none;
  font-weight: 600;
  color: var(--color-gold);
}

/* --- Cuadros de Alerta Inteligente --- */
.alert-banner {
  background: var(--bg-card);
  border-left: 3px solid var(--color-gold);
  padding: 12px 16px;
  border-radius: var(--border-radius-sm);
  margin-bottom: 14px;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.alert-banner.danger {
  border-left-color: var(--color-danger);
  background: rgba(231, 29, 54, 0.03);
}

.alert-banner.warning {
  border-left-color: var(--color-warning);
  background: rgba(255, 159, 28, 0.03);
}

/* --- Tablas Responsivas para Auditoría --- */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.audit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  text-align: left;
}

.audit-table th {
  padding: 10px;
  background: rgba(255,255,255,0.03);
  color: var(--text-secondary);
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
}

.audit-table td {
  padding: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  vertical-align: top;
}

.audit-badge {
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  display: inline-block;
}

.audit-badge.config { background: var(--color-warning-bg); color: var(--color-warning); }
.audit-badge.ingreso { background: var(--color-success-bg); color: var(--color-success); }
.audit-badge.gasto { background: var(--color-danger-bg); color: var(--color-danger); }
.audit-badge.sistema { background: rgba(255,255,255,0.08); color: #fff; }

/* Ocultar elementos basados en roles y sedes */
.admin-only, .madrid-only, .personal-only {
  display: none !important;
}

body.role-admin .admin-only {
  display: block !important;
}

body.role-admin button.admin-only {
  display: inline-flex !important;
}

body.role-admin tr.admin-only {
  display: table-row !important;
}

body.role-admin span.admin-only, body.role-admin div.admin-only {
  display: block !important;
}

/* Gráfico de barras simple usando CSS Flex */
.svg-chart-container {
  height: 180px;
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  padding-top: 20px;
  margin-top: 10px;
  border-bottom: 1px solid var(--border-color);
  position: relative;
}

.chart-bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  height: 100%;
  justify-content: flex-end;
  max-width: 50px;
}

.chart-bar-fill {
  width: 70%;
  background: linear-gradient(180deg, var(--color-gold) 0%, var(--bg-card-hover) 100%);
  border-top-left-radius: 4px;
  border-top-right-radius: 4px;
  position: relative;
  transition: height var(--transition-normal);
  display: flex;
  justify-content: center;
}

.chart-bar-fill.danger {
  background: linear-gradient(180deg, var(--color-danger) 0%, var(--bg-card-hover) 100%);
}

.chart-bar-value {
  position: absolute;
  top: -20px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-primary);
}

.chart-bar-label {
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-top: 8px;
  white-space: nowrap;
}

/* Controles de exportación */
.export-options-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 10px;
}

@media(min-width: 480px) {
  .export-options-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* Hide app content when logged out */
body.logged-out .app-container,
body.logged-out .mobile-nav-bar,
body.logged-out .floating-action-container {
  display: none !important;
}

/* ==========================================
   [PANTALLA DE INICIO DE SESIÓN]
   ========================================== */
.login-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(at 10% 20%, rgba(212, 175, 55, 0.05) 0px, transparent 50%),
    radial-gradient(at 90% 80%, rgba(212, 175, 55, 0.03) 0px, transparent 50%);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  padding: 20px;
  box-sizing: border-box;
}

.login-screen.hidden {
  display: none !important;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 30px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 25px;
}

.login-logo .logo-icon {
  background: var(--gradient-gold);
  color: #000;
  font-weight: 900;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 1.1rem;
}

.login-logo .logo-text {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 1px;
  margin: 0;
}

.login-logo .logo-text span {
  color: var(--color-gold);
}

.login-title {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: center;
  margin-top: 0;
  margin-bottom: 25px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.login-error-msg {
  background: rgba(239, 83, 80, 0.1);
  border: 1px solid var(--color-danger);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* --- Desglose de Métodos de Pago --- */
.payment-methods-breakdown {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.payment-method-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.payment-method-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
}
.payment-method-name-icon {
  display: flex;
  align-items: center;
  gap: 8px;
}
.payment-method-name-icon i {
  width: 18px;
  text-align: center;
  color: var(--color-gold);
  font-size: 1rem;
}
.payment-method-amount {
  font-weight: 700;
  color: var(--text-primary);
}

/* --- Sugerencias Administrativas --- */
.admin-suggestions-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.suggestion-item {
  display: flex;
  gap: 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 14px;
  align-items: flex-start;
  transition: all var(--transition-fast);
}
.suggestion-item:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.12);
}
.suggestion-icon {
  font-size: 1.25rem;
  margin-top: 2px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.suggestion-icon.danger { color: var(--color-danger); }
.suggestion-icon.warning { color: var(--color-warning); }
.suggestion-icon.info { color: var(--color-success); }

.suggestion-text-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.suggestion-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
}
.suggestion-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
}
.suggestion-desc strong {
  color: var(--text-primary);
}

/* --- Estilos para fórmulas de Desglose de KPIs --- */
.formula-box {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 16px;
  margin-bottom: 16px;
}

.formula-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  margin-bottom: 12px;
}

.formula-math {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  font-size: 1.1rem;
  font-weight: 500;
}

.formula-item {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  padding: 8px 14px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 100px;
}

.formula-item .val {
  font-weight: 700;
  font-size: 1.25rem;
}

.formula-item .lbl {
  font-size: 0.65rem;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-top: 4px;
  text-align: center;
}

.formula-op {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-gold);
  user-select: none;
}
