/* ============================================
   SISTEMA DE FACTURACIÓN - ESTILOS
   ============================================ */

/* VARIABLES */
:root {
  --primary: #667eea;
  --primary-dark: #5568d3;
  --secondary: #64748b;
  --success: #48bb78;
  --warning: #ed8936;
  --danger: #f56565;
  --info: #4299e1;
  
  --bg-light: #f8f9fa;
  --bg-white: #ffffff;
  --border: #e2e8f0;
  --text: #1a202c;
  --text-muted: #718096;
  
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.12);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.15);
  
  --radius: 8px;
  --radius-lg: 12px;
}

/* RESET Y BASE */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg-light);
  color: var(--text);
  line-height: 1.6;
}

/* NAVBAR */
.navbar {
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-sm);
}

.nav-brand {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

.nav-menu {
  display: flex;
  gap: 1.5rem;
}

.nav-menu a {
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  transition: all 0.3s;
}

.nav-menu a:hover {
  color: var(--primary);
  background: var(--bg-light);
}

.nav-menu a.active {
  color: var(--primary);
  background: rgba(102, 126, 234, 0.1);
}

/* CONTAINER */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
}

/* SECTION */
.section {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
}

.section h2 {
  margin-bottom: 0.5rem;
  color: var(--text);
}

.section h3 {
  margin-bottom: 1rem;
  color: var(--text);
  font-size: 1.2rem;
}

.text-muted {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* STATS GRID */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

.stat-card {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  color: white;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-md);
  transition: transform 0.3s;
}

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.stat-card.blue {
  background: linear-gradient(135deg, #667eea 0%, #5568d3 100%);
}

.stat-card.green {
  background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
}

.stat-card.purple {
  background: linear-gradient(135deg, #9f7aea 0%, #805ad5 100%);
}

.stat-card.orange {
  background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%);
}

.stat-icon {
  font-size: 2.5rem;
  opacity: 0.9;
}

.stat-content {
  flex: 1;
}

.stat-label {
  font-size: 0.9rem;
  opacity: 0.9;
  margin-bottom: 0.25rem;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
}

.stat-change {
  font-size: 0.85rem;
  opacity: 0.8;
  margin-top: 0.25rem;
}

.stat-detail {
  font-size: 0.85rem;
  opacity: 0.8;
}

/* FILTROS */
.filters {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 0.75rem 1.5rem;
  border: 2px solid var(--border);
  background: var(--bg-white);
  color: var(--text);
  border-radius: var(--radius);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
}

.filter-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.filter-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* CHARTS */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 2rem;
}

.chart-card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.chart-card h3 {
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

.chart-card canvas {
  max-height: 300px;
}

/* TABLES */
.tables-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 2rem;
}

.table-card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.table-card h3 {
  margin-bottom: 1rem;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table thead {
  background: var(--bg-light);
}

.data-table th {
  padding: 0.75rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.data-table td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.data-table tbody tr:hover {
  background: var(--bg-light);
}

.data-table .loading,
.data-table .empty {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
}

/* ACTIONS */
.actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
}

.action-btn {
  padding: 1rem 1.5rem;
  background: var(--bg-white);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  text-align: left;
}

.action-btn:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* BUTTONS */
.btn-primary, .btn-secondary, .btn-danger {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  font-size: 1rem;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--secondary);
  color: white;
}

.btn-secondary:hover {
  background: #475569;
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: #e53e3e;
}

.btn-reset {
  padding: 0.75rem 1.5rem;
  background: transparent;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-reset:hover {
  border-color: var(--text-muted);
  color: var(--text-muted);
}

.btn-icon {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--radius);
  transition: all 0.3s;
}

.btn-icon:hover {
  background: var(--bg-light);
}

.btn-icon.danger:hover {
  background: rgba(245, 101, 101, 0.1);
  color: var(--danger);
}

/* FILTROS PANEL */
.filters-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.search-box {
  display: flex;
  gap: 0.5rem;
}

.search-box input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
}

.search-box button {
  padding: 0.75rem 1.5rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

.search-box button:hover {
  background: var(--primary-dark);
}

.filters-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.filters-row select {
  padding: 0.75rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-white);
  font-size: 1rem;
  cursor: pointer;
}

/* QUICK STATS */
.quick-stats {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  justify-content: space-around;
  padding: 1rem;
  background: var(--bg-light);
  border-radius: var(--radius);
}

.quick-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.quick-stat .label {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.quick-stat .value {
  font-size: 1.5rem;
  font-weight: 700;
}

.quick-stat .value.green {
  color: var(--success);
}

.quick-stat .value.orange {
  color: var(--warning);
}

.quick-stat .value.blue {
  color: var(--primary);
}

/* TABLE HEADER */
.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

/* TABLE CONTAINER */
.table-container {
  overflow-x: auto;
}

.facturas-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1000px;
}

.facturas-table thead {
  background: var(--bg-light);
}

.facturas-table th {
  padding: 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
}

.facturas-table td {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
}

.facturas-table tbody tr:hover {
  background: var(--bg-light);
}

.actions-btns {
  display: flex;
  gap: 0.5rem;
}

/* BADGES */
.badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
}

.badge.blue {
  background: rgba(66, 153, 225, 0.1);
  color: #2b6cb0;
}

.badge.green {
  background: rgba(72, 187, 120, 0.1);
  color: #22543d;
}

.badge.orange {
  background: rgba(237, 137, 54, 0.1);
  color: #c05621;
}

.badge.red {
  background: rgba(245, 101, 101, 0.1);
  color: #c53030;
}

.badge.gray {
  background: rgba(160, 174, 192, 0.1);
  color: #4a5568;
}

.badge.yellow {
  background: rgba(237, 207, 54, 0.1);
  color: #975a16;
}

/* PAGINACIÓN */
.pagination {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 2rem;
}

.pagination button {
  padding: 0.5rem 1rem;
  border: 2px solid var(--border);
  background: var(--bg-white);
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 500;
  transition: all 0.3s;
}

.pagination button:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.pagination button.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.pagination span {
  display: flex;
  align-items: center;
  padding: 0 0.5rem;
  color: var(--text-muted);
}

/* LOADING */
.loading {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}

.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top: 3px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
/* ============================================
   MODALES
   ============================================ */

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(5px);
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: modalSlideIn 0.3s ease-out;
}

.modal-content.large {
  max-width: 900px;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 2rem;
  color: var(--text-muted);
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.3s;
}

.modal-close:hover {
  background: var(--bg-light);
  color: var(--text);
}

.modal-body {
  padding: 2rem;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 1.5rem 2rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
}

/* ============================================
   DETALLE FACTURA
   ============================================ */

.factura-detalle {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.detalle-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--border);
}

.detalle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

.detalle-section {
  padding: 1rem;
  background: var(--bg-light);
  border-radius: var(--radius);
}

.detalle-section h4 {
  margin-bottom: 0.75rem;
  color: var(--primary);
  font-size: 1rem;
}

.detalle-section p {
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

.detalle-lineas {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.5rem;
}

.detalle-lineas thead {
  background: var(--bg-white);
}

.detalle-lineas th {
  padding: 0.75rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
}

.detalle-lineas td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.detalle-lineas small {
  display: block;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

.detalle-totales {
  background: var(--bg-light);
  padding: 1.5rem;
  border-radius: var(--radius);
}

.total-row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  font-size: 1rem;
}

.total-row.final {
  margin-top: 0.5rem;
  padding-top: 1rem;
  border-top: 2px solid var(--border);
  font-size: 1.3rem;
  color: var(--primary);
}

/* ============================================
   FORMULARIOS
   ============================================ */

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group.full {
  grid-column: 1 / -1;
}

.form-group.small {
  min-width: 100px;
}

.form-group label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 0.75rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  transition: all 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group input.readonly {
  background: var(--bg-light);
  cursor: not-allowed;
}

.form-group small {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.form-actions {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
  justify-content: flex-end;
}

.warning {
  color: var(--danger);
  background: rgba(245, 101, 101, 0.1);
  padding: 0.75rem;
  border-radius: var(--radius);
  margin: 1rem 0;
}

/* ============================================
   TABS
   ============================================ */

.tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 2px solid var(--border);
  margin-bottom: 2rem;
}

.tab {
  padding: 1rem 1.5rem;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.3s;
}

.tab:hover {
  color: var(--primary);
  background: var(--bg-light);
}

.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ============================================
   ALERTAS
   ============================================ */

.alert {
  display: flex;
  gap: 1rem;
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  background: var(--bg-light);
  border-left: 4px solid var(--primary);
  align-items: center;
}

.alert.success {
  background: rgba(72, 187, 120, 0.1);
  border-left-color: var(--success);
}

.alert.warning {
  background: rgba(237, 137, 54, 0.1);
  border-left-color: var(--warning);
}

.alert.danger {
  background: rgba(245, 101, 101, 0.1);
  border-left-color: var(--danger);
}

.alert-icon {
  font-size: 2rem;
}

.alert-content {
  flex: 1;
}

.alert-content strong {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 1.1rem;
}

.alert-content p {
  margin: 0;
  color: var(--text-muted);
}

/* ============================================
   FORMAS DE PAGO
   ============================================ */

.formas-pago-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.forma-pago-card {
  background: var(--bg-light);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  border: 2px solid var(--border);
  transition: all 0.3s;
}

.forma-pago-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.forma-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.forma-icon {
  font-size: 2rem;
}

.forma-pago-card h3 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.forma-pago-card p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.forma-config {
  margin-top: 1rem;
}

.forma-config input {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
}

/* SWITCH TOGGLE */
.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: .4s;
  border-radius: 28px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--primary);
}

input:checked + .slider:before {
  transform: translateX(22px);
}

/* ============================================
   COLOR PICKER
   ============================================ */

.color-picker {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.color-picker input[type="color"] {
  width: 60px;
  height: 40px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
}

.color-picker input[type="text"] {
  flex: 1;
}

/* ============================================
   UPLOAD BOX
   ============================================ */

.upload-box {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
}

.upload-box:hover:not(.disabled) {
  border-color: var(--primary);
  background: var(--bg-light);
}

.upload-box.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.upload-icon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
  color: var(--text-muted);
}

.upload-box p {
  color: var(--text-muted);
  margin: 0;
}

/* ============================================
   INFO BOX
   ============================================ */

.info-box {
  background: var(--bg-light);
  padding: 1rem;
  border-radius: var(--radius);
  border-left: 4px solid var(--primary);
}

.info-box p {
  margin: 0.5rem 0;
}

/* ============================================
   FACTURA SECTION
   ============================================ */

.factura-section {
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.factura-section:last-child {
  border-bottom: none;
}

.factura-section h3 {
  margin-bottom: 1rem;
  color: var(--primary);
}

/* ============================================
   LÍNEAS DE FACTURA
   ============================================ */

#lineas-factura {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1rem;
}

.linea-factura {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 1.5rem;
  background: var(--bg-light);
  border-radius: var(--radius-lg);
  border: 2px solid var(--border);
}

.linea-numero {
  width: 30px;
  height: 30px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}

.linea-campos {
  flex: 1;
}

/* ============================================
   TOTALES FACTURA
   ============================================ */

.totales-factura {
  background: var(--bg-light);
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  max-width: 400px;
  margin-left: auto;
}

/* ============================================
   NOTIFICACIONES
   ============================================ */

.notification {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  padding: 1rem 1.5rem;
  background: var(--bg-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 2000;
  transform: translateX(400px);
  transition: transform 0.3s ease-out;
}

.notification.show {
  transform: translateX(0);
}

.notification.success {
  border-left: 4px solid var(--success);
}

.notification.error {
  border-left: 4px solid var(--danger);
}

.notification.info {
  border-left: 4px solid var(--info);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
  .navbar {
    flex-direction: column;
    gap: 1rem;
  }
  
  .nav-menu {
    flex-direction: column;
    width: 100%;
  }
  
  .nav-menu a {
    text-align: center;
  }
  
  .container {
    padding: 1rem;
  }
  
  .section {
    padding: 1.5rem;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .charts-grid {
    grid-template-columns: 1fr;
  }
  
  .tables-grid {
    grid-template-columns: 1fr;
  }
  
  .actions-grid {
    grid-template-columns: 1fr;
  }
  
  .form-grid {
    grid-template-columns: 1fr;
  }
  
  .filters {
    flex-direction: column;
  }
  
  .filters-row {
    flex-direction: column;
  }
  
  .modal-content {
    width: 95%;
    max-height: 95vh;
  }
  
  .modal-body {
    padding: 1.5rem;
  }
  
  .table-container {
    overflow-x: scroll;
  }
  
  .detalle-grid {
    grid-template-columns: 1fr;
  }
  
  .formas-pago-grid {
    grid-template-columns: 1fr;
  }
  
  .linea-factura {
    flex-direction: column;
  }
  
  .totales-factura {
    max-width: 100%;
  }
  
  .quick-stats {
    flex-direction: column;
    gap: 1rem;
  }
  
  .table-header {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }
  
  .form-actions {
    flex-direction: column;
  }
  
  .modal-footer {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .stat-card {
    flex-direction: column;
    text-align: center;
  }
  
  .stat-icon {
    font-size: 2rem;
  }
  
  .stat-value {
    font-size: 1.5rem;
  }
}

/* ============================================
   UTILIDADES
   ============================================ */

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

.hidden {
  display: none !important;
}

.flex {
  display: flex;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }

/* ============================================
   ANIMACIONES
   ============================================ */

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.3s ease-in;
}

.slide-down {
  animation: slideDown 0.3s ease-out;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

/* Mobile & Tablets */
@media (max-width: 768px) {
  .navbar {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    text-align: center;
  }

  .nav-menu {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
  }

  .container {
    padding: 1rem;
  }

  .section {
    padding: 1.25rem;
  }

  .table-header {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
    text-align: center;
  }

  /* Transformar Tablas en Tarjetas */
  .facturas-table, 
  .facturas-table thead, 
  .facturas-table tbody, 
  .facturas-table tr, 
  .facturas-table td,
  .data-table,
  .data-table thead,
  .data-table tbody,
  .data-table tr,
  .data-table td {
    display: block;
    width: 100%;
  }

  .facturas-table, .data-table {
    min-width: 100% !important;
  }

  .facturas-table thead, .data-table thead {
    display: none; /* Escondemos cabecera */
  }

  .facturas-table tr, .data-table tr {
    margin-bottom: 1.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: white;
    box-shadow: var(--shadow-sm);
  }

  .facturas-table td, .data-table td {
    text-align: right;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--bg-light);
    position: relative;
    min-height: 2.5rem;
  }

  .facturas-table td::before, .data-table td::before {
    content: attr(data-label);
    position: absolute;
    left: 1rem;
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
  }

  .facturas-table td:last-child {
    text-align: center;
    background: var(--bg-light);
    border: none;
  }

  .actions-btns {
    justify-content: center;
  }

  /* Ajustar modales para móvil */
  .modal-content {
    width: 95%;
    max-height: 95vh;
  }

  .form-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
  .navbar,
  .filters,
  .filters-panel,
  .modal-footer,
  .actions-btns,
  .pagination,
  button {
    display: none !important;
  }
  
  body {
    background: white;
  }
  
  .section {
    box-shadow: none;
    border: 1px solid #ddd;
  }
}