/* ==========================================================================
   COLOSO NÓMINA CORTE - DESIGN SYSTEM & STYLES (OPTIMIZADO 2X3 FULL-SCREEN)
   ========================================================================== */

:root {
  /* Brand Colors */
  --coloso-red: #dc2626;
  --coloso-red-hover: #b91c1c;
  --coloso-red-light: #fef2f2;
  --coloso-red-border: #fecaca;

  --sentinel-slate: #0f172a;
  --sentinel-gray: #475569;
  --sentinel-light: #f8fafc;

  /* UI Palette */
  --bg-app: #f1f5f9;
  --bg-card: #ffffff;
  --bg-muted: #f8fafc;

  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;

  --border-light: #e2e8f0;
  --border-medium: #cbd5e1;
  --border-dark: #94a3b8;

  --danger-color: #ef4444;
  --danger-hover: #dc2626;

  /* Typography */
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Elevation Shadows */
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.08);

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* App Outer Wrapper */
.app-wrapper {
  max-width: 1200px;
  width: 100%;
  min-height: calc(100vh - 48px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Disable spin buttons on input */
.input-no-spinners::-webkit-outer-spin-button,
.input-no-spinners::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.input-no-spinners {
  -moz-appearance: textfield;
}

/* ==========================================================================
   CABECERA FLOTANTE CON MARGEN Y LOGOS
   ========================================================================== */
.app-header {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 16px 28px;
  box-shadow: var(--shadow-sm);
}

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

.brand-left {
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  text-decoration: none;
}

.brand-logo-img {
  height: 48px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(220, 38, 38, 0.1));
  transition: transform 0.2s ease;
}

.brand-left:hover .brand-logo-img {
  transform: scale(1.02);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.brand-title span {
  color: var(--coloso-red);
}

.brand-subtitle {
  font-size: 0.75rem;
  color: var(--sentinel-gray);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.brand-right {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-muted);
  padding: 6px 16px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-light);
}

.sentinel-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--sentinel-gray);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.sentinel-logo-img {
  height: 24px;
  width: auto;
  object-fit: contain;
}

/* ==========================================================================
   CONTENEDOR PRINCIPAL Y RETÍCULA BALANCEADA (2 FILAS X 3 COLUMNAS FULL-HEIGHT)
   ========================================================================== */
.main-content {
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.menu-modules-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  flex: 1;
  align-items: stretch;
}

@media (max-width: 960px) {
  .menu-modules-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .menu-modules-grid {
    grid-template-columns: 1fr;
  }
}

.module-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 36px 28px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 16px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  min-height: 210px;
}

.module-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: var(--coloso-red);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.module-card:hover {
  border-color: var(--border-medium);
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.module-card:hover::before {
  opacity: 1;
}

.module-card:hover .module-icon {
  background: var(--coloso-red-light);
  border-color: var(--coloso-red-border);
  color: var(--coloso-red);
}

/* Minimalist SVG Icon Container */
.module-icon {
  background: #f1f5f9;
  color: var(--sentinel-slate);
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  transition: all 0.25s ease;
}

.icon-svg {
  width: 24px;
  height: 24px;
}

.module-name {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.module-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ==========================================================================
   CARDS, COMPONENTES GENERALES Y FORMULARIOS
   ========================================================================== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  box-shadow: var(--shadow-sm);
}

.card-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.input-field {
  width: 100%;
  padding: 12px 16px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--text-primary);
  background: var(--bg-muted);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  outline: none;
  transition: all 0.2s ease;
}

.input-field-mono {
  font-family: var(--font-mono);
}

.input-field:focus {
  border-color: var(--coloso-red);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

/* Back Button Component */
.back-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.back-btn:hover {
  background: var(--border-light);
  color: var(--text-primary);
}

/* Button System */
.btn {
  padding: 10px 20px;
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--coloso-red);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--coloso-red-hover);
}

.btn-primary:disabled {
  background: var(--border-dark);
  cursor: not-allowed;
}

.btn-secondary {
  background: #ffffff;
  color: var(--text-primary);
  border-color: var(--border-medium);
}

.btn-secondary:hover {
  background: var(--bg-muted);
  border-color: var(--border-dark);
}

.btn-danger {
  background: #fee2e2;
  color: var(--danger-hover);
  border-color: #fca5a5;
}

.btn-danger:hover {
  background: var(--danger-hover);
  color: #ffffff;
}

.btn-icon-danger {
  background: transparent;
  border: none;
  color: var(--danger-color);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: background 0.2s ease;
}

.btn-icon-danger:hover {
  background: #fee2e2;
}

/* Estilo Badge Button para la Matriz y Header */
.btn-estilo-badge {
  background: #ffffff;
  border: 1px solid var(--coloso-red-border);
  color: var(--coloso-red);
  font-weight: 700;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-estilo-badge:hover {
  background: var(--coloso-red);
  color: #ffffff;
  border-color: var(--coloso-red);
  transform: scale(1.04);
}

/* ==========================================================================
   TABLAS INDUSTRIALES DE CAPTURA Y MATRIZ (100% FIT)
   ========================================================================== */
.table-container {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
}

.batch-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.batch-table th {
  background: var(--bg-muted);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-medium);
}

.batch-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.9rem;
}

.batch-table tr:last-child td {
  border-bottom: none;
}

.batch-table-fit {
  width: 100%;
  table-layout: auto;
  border-collapse: collapse;
}

.batch-table-fit th {
  padding: 8px 5px;
  font-size: 0.76rem;
  text-align: center;
  background: var(--sentinel-light);
  color: var(--sentinel-slate);
  font-weight: 700;
  border-bottom: 1px solid var(--border-medium);
  white-space: nowrap;
}

.batch-table-fit td {
  padding: 8px 5px;
  font-size: 0.78rem;
  text-align: center;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  white-space: nowrap;
}

.batch-table-fit td.align-left {
  text-align: left;
}

.batch-summary-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
}

/* ==========================================================================
   MODALES Y TOAST NOTIFICATIONS
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

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

.modal-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 480px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-medium);
}

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 2000;
}

.toast {
  background: var(--sentinel-slate);
  color: #ffffff;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--coloso-red);
  animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.danger {
  background: var(--coloso-red);
  border-left-color: var(--coloso-red-dark);
}

@keyframes slideIn {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
