@page {
  size: A4 landscape;
  margin: 0;
}

:root {
  --primary-navy: #002060;
  --primary-blue: #0d47a1;
  --accent-green: #00cc00;
  --accent-lightgreen: #ccff66;
  --table-header-green: #ccff99;
  --table-header-gray: #d9d9d9;
  --bg-main: #f4f7fb;
  --bg-card: #ffffff;
  --text-dark: #1e293b;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -1px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.03);
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-dark);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* App Header */
.app-header {
  background: linear-gradient(135deg, #001a4d 0%, #002060 100%);
  color: white;
  padding: 16px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 4px 12px rgba(0, 32, 96, 0.2);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand-logo {
  height: 48px;
  width: auto;
  background: white;
  padding: 4px 10px;
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

.brand-info h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin-bottom: 2px;
}

.brand-info .subtitle {
  font-size: 12px;
  opacity: 0.88;
  color: #e2e8f0;
}

.brand-info .subtitle strong {
  color: var(--accent-lightgreen);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.account-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #cbd5e1;
}

.status-dot.online {
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
}

.date-selector-group {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.date-input {
  background: white;
  border: 1px solid #cbd5e1;
  padding: 6px 10px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dark);
}

/* App Main */
.app-main {
  max-width: 1540px;
  margin: 20px auto;
  padding: 0 20px;
}

/* Toolbar */
.toolbar-section {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  padding: 14px 20px;
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 12px;
}

.toolbar-left, .toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-group {
  display: flex;
  align-items: center;
}

.btn-group .btn {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.sync-select {
  border: 1px solid #cbd5e1;
  border-left: none;
  background: #f8fafc;
  padding: 8px 10px;
  border-top-right-radius: 8px;
  border-bottom-right-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dark);
  cursor: pointer;
  height: 38px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  height: 38px;
}

.btn-primary {
  background: #0284c7;
  color: white;
}
.btn-primary:hover {
  background: #0369a1;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.35);
}

.btn-secondary {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
}
.btn-secondary:hover {
  background: #e2e8f0;
}

.btn-outline {
  background: white;
  color: #002060;
  border: 1px solid #cbd5e1;
}
.btn-outline:hover {
  background: #f8fafc;
  border-color: #002060;
}

.btn-success {
  background: #16a34a;
  color: white;
}
.btn-success:hover {
  background: #15803d;
  box-shadow: 0 2px 8px rgba(22, 163, 74, 0.35);
}

/* 3-Step Cold Chain Workflow Bar */
.workflow-section {
  margin-bottom: 20px;
}

.workflow-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: white;
  border: 1.5px solid #cbd5e1;
  border-radius: 12px;
  padding: 14px 20px;
  box-shadow: 0 4px 12px rgba(0, 32, 96, 0.06);
  gap: 16px;
  flex-wrap: wrap;
}

.step-item {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 240px;
}

.step-badge {
  background: #002060;
  color: #ccff66;
  font-weight: 700;
  font-size: 11px;
  padding: 5px 9px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.step-content {
  display: flex;
  flex-direction: column;
}

.step-title {
  font-size: 13.5px;
  font-weight: 700;
  color: #002060;
}

.step-desc {
  font-size: 11px;
  color: #64748b;
}

.step-divider {
  color: #94a3b8;
  font-size: 18px;
  font-weight: bold;
}

.step-select {
  padding: 8px 12px;
  border: 1.5px solid #0284c7;
  border-radius: 8px;
  background: #f0f9ff;
  color: #0369a1;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  min-width: 220px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.step-select:focus {
  border-color: #0369a1;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.2);
}

.step-buttons {
  display: flex;
  gap: 8px;
}

.btn-step {
  padding: 7px 14px;
  font-size: 12px;
  border-radius: 6px;
  white-space: nowrap;
}

.print-tip-bar {
  margin-top: 10px;
  background: #f8fafc;
  border: 1px dashed #94a3b8;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 11.5px;
  color: #475569;
  display: flex;
  align-items: center;
  gap: 10px;
  line-height: 1.4;
}

.print-tip-bar .tip-icon {
  font-size: 16px;
}

/* Stats Cards */
.stats-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat-card {
  background: var(--bg-card);
  padding: 14px 18px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  border: 1px solid #edf2f7;
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.bg-blue { background: #e0f2fe; color: #0369a1; }
.bg-teal { background: #ccfbf1; color: #0f766e; }
.bg-purple { background: #f3e8ff; color: #7e22ce; }
.bg-navy { background: #e0e7ff; color: #3730a3; }
.bg-amber { background: #fef3c7; color: #b45309; }

.stat-data {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1.1;
}

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 2px;
}

/* Filter Section */
.filter-section {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 12px;
}

.filter-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill {
  background: #e2e8f0;
  border: none;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
}

.pill:hover {
  background: #cbd5e1;
}

.pill.active {
  background: var(--primary-navy);
  color: white;
}

.pill.pill-danger {
  background: #fee2e2;
  color: #b91c1c;
}

.pill.pill-danger:hover {
  background: #fecaca;
}

.pill.pill-danger.active {
  background: #dc2626;
  color: white;
}

.search-box {
  position: relative;
  width: 320px;
}

.search-box .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  opacity: 0.6;
}

.search-box input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  background: white;
}

/* Drop Zone */
.drop-zone {
  border: 2px dashed #94a3b8;
  background: #f8fafc;
  border-radius: 10px;
  padding: 16px;
  text-align: center;
  margin-bottom: 16px;
  transition: all 0.2s ease;
  cursor: pointer;
}

.drop-zone.dragover {
  border-color: #0284c7;
  background: #f0f9ff;
}

.drop-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #475569;
  font-size: 13px;
}

.drop-icon {
  font-size: 20px;
}

/* Data Table Card */
.table-card {
  background: var(--bg-card);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  border: 1px solid #edf2f7;
  overflow: hidden;
}

.table-header {
  padding: 14px 20px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.table-header h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary-navy);
}

.table-hint {
  font-size: 12px;
  color: var(--text-muted);
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  text-align: left;
}

.data-table th {
  background: #f8fafc;
  color: var(--primary-navy);
  font-weight: 600;
  padding: 10px 12px;
  border-bottom: 2px solid #e2e8f0;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background-color: #f8fafc;
}

.col-highlight {
  background: #fefce8 !important;
}

.client-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
}

.badge-ecomch { background: #ccfbf1; color: #0f766e; }
.badge-aristeia { background: #f3e8ff; color: #7e22ce; }
.badge-qfpro { background: #e0e7ff; color: #3730a3; }
.badge-blau { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; font-weight: 600; }
.badge-excel { background: #e2e8f0; color: #334155; }
.badge-otro { background: #fef3c7; color: #b45309; }

.delivery-date-tag {
  display: inline-block;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid #bfdbfe;
  margin-top: 3px;
}

.cold-tag {
  display: inline-block;
  background: #e0f2fe;
  color: #0369a1;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  margin-top: 3px;
  margin-right: 4px;
}

.controlled-tag {
  display: inline-block;
  background: #fee2e2;
  color: #b91c1c;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  margin-top: 3px;
}

/* Sanitary Establishment Verification Badges */
.sanitary-badge {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 4px;
  margin-top: 4px;
  font-weight: 600;
  line-height: 1.3;
}

.sanitary-badge.verified {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.sanitary-badge.street-match {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.sanitary-badge.warning {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.sanitary-badge.check {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #e2e8f0;
}

.maps-btn {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 3px;
  background: #ffffff;
  color: #002060;
  border: 1px solid #cbd5e1;
  text-decoration: none;
  margin-left: 4px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.maps-btn:hover {
  background: #002060;
  color: #ffffff;
  border-color: #002060;
}

/* Annulled & Replacement Styling */
.annulled-row {
  opacity: 0.65;
  background-color: #fff1f2 !important;
}

.annulled-row:hover {
  opacity: 0.95;
}

.annulled-badge {
  display: inline-block;
  background: #ef4444;
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  margin-top: 3px;
  letter-spacing: 0.3px;
}

.replacement-badge {
  display: inline-block;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  margin-top: 3px;
  border: 1px solid #bfdbfe;
}

.editable-cell {
  width: 100%;
  padding: 4px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  font-family: inherit;
  font-size: 12px;
  background: #ffffff;
}

.editable-cell:focus {
  border-color: #0284c7;
  outline: none;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.2);
}

.action-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.action-btn:hover {
  background: #fee2e2;
  color: #dc2626;
}

/* Multi-Contenedor Styling */
.btn-add-cont-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #86efac;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  cursor: pointer;
  margin-top: 5px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-add-cont-pill:hover {
  background: #16a34a;
  color: #ffffff;
  border-color: #15803d;
}

.btn-del-cont-pill {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
  font-size: 11px;
  padding: 3px 6px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-del-cont-pill:hover {
  background: #ef4444;
  color: white;
}

.sub-container-row {
  background: #f8fafc;
}

.sub-container-row td {
  border-top: 1px dashed #cbd5e1 !important;
}

.sub-container-tag {
  display: inline-block;
  background: #e0e7ff;
  color: #3730a3;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  margin-bottom: 2px;
}

/* Empty State */
.empty-state {
  padding: 50px 20px;
  text-align: center;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 40px;
  margin-bottom: 10px;
}

.empty-state h4 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 6px;
}

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 999;
  align-items: center;
  justify-content: center;
}

.modal-overlay.open {
  display: flex;
}

.modal-card {
  background: white;
  width: 560px;
  max-width: 95%;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-header {
  padding: 16px 20px;
  background: var(--primary-navy);
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.close-btn {
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
}

.modal-body {
  padding: 20px;
}

.form-row {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

.form-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 12px;
}

.col-4 { flex: 4; }
.col-5 { flex: 5; }
.col-6 { flex: 6; }
.col-7 { flex: 7; }
.col-8 { flex: 8; }

.form-group label {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
  color: #334155;
}

.form-control {
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-family: inherit;
  font-size: 13px;
}

.form-control:focus {
  border-color: #0284c7;
  outline: none;
}

.checkbox-group {
  justify-content: center;
}

.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

/* Loading Overlay */
.loading-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(6px);
  z-index: 1000;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: white;
}

.loading-overlay.active {
  display: flex;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--accent-lightgreen);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-overlay h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 6px;
}

.loading-overlay p {
  font-size: 13px;
  opacity: 0.85;
}

/* ==========================================================================
   PRINT STYLES: OFFICIAL RE02 TRANSFARMA FORMAT FOR BODEGA FLOOR (A4 LANDSCAPE)
   ========================================================================== */
.print-only {
  display: none;
}

@media print {
  @page {
    size: A4 landscape;
    margin: 0mm; /* Elimina automáticamente la URL, fecha y numeración nativa del navegador en Chrome/Edge */
  }

  body {
    background: white !important;
    color: black !important;
    font-family: 'Century Gothic', Arial, sans-serif !important;
    font-size: 8pt !important;
    padding: 8mm 6mm !important;
    margin: 0 !important;
    box-sizing: border-box !important;
  }

  .no-print {
    display: none !important;
  }

  .print-only {
    display: block !important;
    width: 100% !important;
  }

  /* Header Table */
  .print-meta-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 4px;
    border-bottom: 2px solid #002060;
    padding-bottom: 3px;
  }

  .print-logo {
    max-height: 38px;
    width: auto;
  }

  .print-doc-title {
    font-size: 10.5pt;
    font-weight: bold;
    color: #002060;
    text-align: center;
    margin: 0;
  }

  .print-doc-subtitle {
    font-size: 7.5pt;
    font-weight: bold;
    color: #333;
    text-align: center;
    margin: 1px 0;
  }

  .print-compliance {
    font-size: 6.5pt;
    font-style: italic;
    color: #555;
    text-align: center;
    margin: 0;
  }

  .code-box {
    border: 1px solid #999;
    padding: 2px 5px;
    font-size: 7pt;
    background: #f8fafc;
    text-align: right;
  }

  .code-box p {
    margin: 1px 0;
  }

  /* Print Data Table */
  .print-data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 7.5pt;
    margin-top: 3px;
  }

  .print-data-table thead {
    display: table-header-group;
  }

  .print-data-table tr {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .print-data-table th, .print-data-table td {
    border: 1px solid #666;
    padding: 3px 4px;
    vertical-align: middle;
  }

  .print-data-table th {
    background-color: #ccff99 !important;
    color: #002060;
    font-weight: bold;
    text-align: center;
    font-size: 7pt;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .print-data-table th.th-fill {
    background-color: #d9d9d9 !important;
  }

  .print-data-table tbody tr:nth-child(even) {
    background-color: #f9f9f9 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .print-data-table td.center {
    text-align: center;
  }

  .print-data-table tr.sub-container-print-row td {
    border-top: 1px dashed #777 !important;
  }

  .print-fill-box {
    display: inline-block;
    width: 100%;
    min-height: 18px;
    border-bottom: 1px dashed #aaa;
  }

  /* Signatures Block */
  .print-signatures-block {
    margin-top: 8px;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .sig-table {
    width: 100%;
    border-collapse: collapse;
  }

  .sig-box {
    border: 1px solid #002060;
    padding: 6px 10px;
    text-align: left;
    margin: 0 4px;
    background: #fafafa;
    min-height: 115px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }

  .sig-role {
    font-size: 8.5pt;
    font-weight: bold;
    color: #002060;
    margin-bottom: 4px;
    text-align: center;
    border-bottom: 1px solid #ccff66;
    padding-bottom: 2px;
  }

  .sig-field-line {
    font-size: 7.5pt;
    color: #222;
    margin: 2px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .sig-field-line span:first-child {
    font-weight: 600;
    min-width: 52px;
  }

  .sig-val-fixed {
    font-size: 8pt;
    font-weight: bold;
    color: #002060;
  }

  .sig-space {
    min-height: 35px;
  }

  .line-dots {
    color: #888;
    letter-spacing: -1px;
  }

  .print-footer-legal {
    text-align: center;
    margin-top: 8px;
    font-size: 7pt;
    font-weight: 600;
    color: #444;
    border-top: 1px solid #00cc00;
    padding-top: 4px;
    letter-spacing: 0.5px;
  }
}
