:root {
  --primary-color: #e52329;
  --secondary-color: #6c757d;
  --dark-color: #2c3e50;
  --light-color: #f8f9fa;
  --success-color: #28a745;
  --warning-color: #ffc107;
  --danger-color: #dc3545;
  --info-color: #17a2b8;
  --border-radius: 8px;
  --box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  --transition: all 0.3s ease;
}

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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #ffffff;
  min-height: 100vh;
  color: #333;
}

/* Login Page */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
}

.login-box {
  background: white;
  padding: 40px;
  border-radius: var(--border-radius);
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.login-box .logo {
  width: 150px;
  margin-bottom: 30px;
}

.login-box h1 {
  color: var(--dark-color);
  margin-bottom: 10px;
  font-size: 28px;
}

.login-box p {
  color: var(--secondary-color);
  margin-bottom: 30px;
}

.form-group {
  margin-bottom: 20px;
  text-align: left;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: var(--dark-color);
  font-weight: 500;
}

.form-group input {
  width: 100%;
  padding: 12px 15px;
  border: 2px solid #e0e0e0;
  border-radius: var(--border-radius);
  font-size: 16px;
  transition: var(--transition);
}

.form-group select {
  width: 100%;
  padding: 12px 15px;
  border: 2px solid #e0e0e0;
  border-radius: var(--border-radius);
  font-size: 16px;
  transition: var(--transition);
  background: #fff;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary-color);
}

.form-group select:focus {
  outline: none;
  border-color: var(--primary-color);
}

.btn {
  padding: 12px 30px;
  border: none;
  border-radius: var(--border-radius);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  display: inline-block;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
  width: 100%;
}

.btn-secondary {
  background: var(--secondary-color);
  color: white;
}

.btn-outline-primary {
  background: #ffffff;
  color: var(--primary-color);
  border: 2px solid var(--primary-color);
}

.btn-outline-secondary {
  background: #ffffff;
  color: var(--secondary-color);
  border: 2px solid var(--secondary-color);
}

.btn-outline-secondary.active {
  background: var(--secondary-color);
  color: #ffffff;
  font-weight: 700;
}

.btn-outline-warning {
  background: #ffffff;
  color: var(--warning-color);
  border: 2px solid var(--warning-color);
}

.btn-outline-warning.active {
  background: var(--warning-color);
  color: #212529;
  font-weight: 700;
}

.btn-outline-info {
  background: #ffffff;
  color: var(--info-color);
  border: 2px solid var(--info-color);
}

.btn-outline-info.active {
  background: var(--info-color);
  color: #ffffff;
  font-weight: 700;
}

.btn-success {
  background: var(--success-color);
  color: white;
}

.btn-danger {
  background: var(--danger-color);
  color: white;
}

.btn-warning {
  background: var(--warning-color);
  color: #212529;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 14px;
}

.alert {
  padding: 12px 20px;
  border-radius: var(--border-radius);
  margin-bottom: 20px;
  font-size: 14px;
}

.alert-danger {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.alert-success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

/* Dashboard */
.dashboard {
  display: none;
  padding: 0;
}

.dashboard.active {
  display: block;
}

.navbar {
  background: white;
  box-shadow: var(--box-shadow);
  padding: 15px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 15px;
}

.navbar-brand img {
  height: 40px;
}

.navbar-brand h2 {
  color: var(--dark-color);
  font-size: 22px;
  margin: 0;
}

.navbar-user {
  display: flex;
  align-items: center;
  gap: 20px;
}

.user-info {
  text-align: right;
}

.user-info .name {
  font-weight: 600;
  color: var(--dark-color);
}

.user-info .role {
  font-size: 12px;
  color: var(--secondary-color);
  text-transform: uppercase;
}

.container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 30px 30px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: #f5f7fb;
  padding: 25px;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  text-align: center;
  transition: var(--transition);
  cursor: pointer;
  border: 2px solid transparent;
}

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

.stat-card.active {
  border-color: var(--primary-color);
  box-shadow: 0 10px 25px rgba(229, 35, 41, 0.2);
  transform: translateY(-4px);
}

.stat-card .number {
  font-size: 36px;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 5px;
}

.stat-card .label {
  color: var(--secondary-color);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.filters {
  background: white;
  padding: 20px;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  margin-bottom: 20px;
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  align-items: center;
}

.search-wrapper {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.search-wrapper input {
  width: 100%;
  padding: 10px 40px 10px 15px;
  border: 2px solid #e0e0e0;
  border-radius: var(--border-radius);
  font-size: 16px;
}

.search-clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 24px;
  color: var(--secondary-color);
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  padding: 0;
  line-height: 1;
}

.filters input,
.filters select {
  padding: 10px 15px;
  border: 2px solid #e0e0e0;
  border-radius: var(--border-radius);
  font-size: 16px;
  flex: 1;
  min-width: 200px;
}

.filters .btn {
  white-space: nowrap;
  min-width: auto;
  flex-shrink: 0;
}

.table-container {
  background: white;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  overflow: hidden;
}

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

.table-header h3 {
  color: var(--dark-color);
  margin: 0;
}

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

thead {
  background: var(--light-color);
}

thead th {
  padding: 15px 20px;
  text-align: left;
  font-weight: 600;
  color: var(--dark-color);
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 1px;
}

thead th[scope="col"]:nth-child(5) {
  width: 300px;
  min-width: 300px;
}

tbody td {
  padding: 15px 20px;
  border-bottom: 1px solid #f0f0f0;
}

tbody td[data-label="Estado"] {
  width: 300px;
  min-width: 300px;
}

tbody tr:hover {
  background: #f8f9fa;
}

tbody tr:last-child td {
  border-bottom: none;
}

.badge {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  margin-right: 6px;
  min-width: 95px;
  text-align: center;
}

.fecha-estado {
  font-weight: 700;
  text-transform: uppercase;
  font-size: 12px;
}

.fecha-hoy {
  color: var(--danger-color);
}

.fecha-ayer {
  color: #d48806;
}

.badge-recogido {
  background: #fff3cd;
  color: #856404;
}

.badge-para_entregar {
  background: #d4edda;
  color: #155724;
}

.badge-no_reparado {
  background: #f8d7da;
  color: #721c24;
}

.badge-entregado {
  background: #d1ecf1;
  color: #0c5460;
}

.badge-para_recoger {
  background: #e6f7ff;
  color: #0050b3;
}

.badge-gestionado {
  background: #d9f7be;
  color: #2f6627;
}

.badge-resultado {
  display: inline-block;
  margin-left: 6px;
  padding: 4px 10px;
  border-radius: 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  background: #f0f0f0;
  color: #555;
  min-width: 90px;
  text-align: center;
}

.badge-resultado-reparado {
  background: #e6fffb;
  color: #08979c;
}

.badge-resultado-no_reparado {
  background: #fff1f0;
  color: #cf1322;
}

.badge-resultado-sin_evaluar {
  background: #f5f5f5;
  color: #555;
}

.badge-clickable {
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  user-select: none;
}

.badge-clickable:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  filter: brightness(1.1);
}

.badge-clickable:active {
  transform: scale(0.95);
}

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

.btn-marcar-gestionado {
  margin-left: 6px;
  margin-top: 6px;
}

.feedback-modal,
.confirm-modal {
  position: fixed;
  inset: 0;
  background: rgba(44, 62, 80, 0.25);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.feedback-modal {
  pointer-events: none;
}

.feedback-modal.active {
  display: flex;
  opacity: 1;
  pointer-events: auto;
}

.feedback-card {
  position: relative;
  background: #ffffff;
  border-radius: 16px;
  padding: 22px 80px 22px 24px;
  display: flex;
  align-items: center;
  gap: 18px;
  box-shadow: 0 25px 80px rgba(17, 24, 39, 0.25);
  min-width: 320px;
  max-width: 420px;
  animation: feedback-pop 0.35s ease;
}

.feedback-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  font-size: 24px;
  font-weight: 700;
}

.feedback-content h4 {
  margin: 0 0 6px;
  font-size: 20px;
  color: var(--dark-color);
}

.feedback-content p {
  margin: 0;
  color: var(--secondary-color);
  font-size: 15px;
  line-height: 1.4;
}

.feedback-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  font-size: 26px;
  color: var(--secondary-color);
  cursor: pointer;
  transition: color 0.2s ease;
}

.feedback-modal.success .feedback-icon {
  background: rgba(40, 167, 69, 0.16);
  color: var(--success-color);
}

.feedback-modal.success .feedback-content h4 {
  color: var(--success-color);
}

.feedback-modal.error .feedback-icon {
  background: rgba(220, 53, 69, 0.16);
  color: var(--danger-color);
}

.feedback-modal.error .feedback-content h4 {
  color: var(--danger-color);
}

.feedback-modal.info .feedback-icon {
  background: rgba(23, 162, 184, 0.16);
  color: var(--info-color);
}

.feedback-modal.info .feedback-content h4 {
  color: var(--info-color);
}

.confirm-modal.active {
  display: flex;
  opacity: 1;
}

.confirm-card {
  background: #ffffff;
  border-radius: 18px;
  padding: 28px 32px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 28px 90px rgba(15, 23, 42, 0.28);
  animation: feedback-pop 0.3s ease;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(229, 35, 41, 0.08);
}

.confirm-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 6px;
  border-radius: 18px 0 0 18px;
  background: var(--secondary-color);
}

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

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

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

.confirm-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 16px;
  background: rgba(108, 117, 125, 0.16);
  color: var(--secondary-color);
}

.confirm-modal.success .confirm-icon {
  background: rgba(40, 167, 69, 0.16);
  color: var(--success-color);
}

.confirm-modal.warning .confirm-icon {
  background: rgba(255, 193, 7, 0.16);
  color: var(--warning-color);
}

.confirm-modal.danger .confirm-icon {
  background: rgba(220, 53, 69, 0.16);
  color: var(--danger-color);
}

.confirm-title {
  margin: 0 0 8px;
  font-size: 22px;
  color: var(--dark-color);
}

.confirm-message {
  margin: 0 0 22px;
  color: var(--secondary-color);
  line-height: 1.5;
}

.confirm-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.confirm-actions .btn {
  min-width: 130px;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: var(--border-radius);
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-content.modal-large {
  max-width: 900px;
}

.modal-content.modal-medium {
  max-width: 560px;
}

.foto-status {
  background: #f5f7fb;
  border-radius: var(--border-radius);
  padding: 12px 16px;
  color: var(--secondary-color);
  margin-bottom: 15px;
  font-size: 14px;
}

.foto-status.foto-info {
  background: #f5f7fb;
  color: var(--secondary-color);
}

.foto-status.foto-warning {
  background: #fff3cd;
  color: #856404;
}

.foto-status.foto-error {
  background: #f8d7da;
  color: #721c24;
}

.foto-stage {
  position: relative;
  width: 100%;
  background: #000;
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 280px;
}

.ticket-video,
.ticket-preview {
  width: 100%;
  height: auto;
  object-fit: contain;
}

.foto-collection {
  margin-bottom: 16px;
}

.foto-counter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(229, 35, 41, 0.12);
  color: var(--primary-color);
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 10px;
}

.foto-counter span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary-color);
  color: #fff;
  font-size: 12px;
}

.foto-thumbs {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.foto-thumb {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease;
  flex-shrink: 0;
}

.foto-thumb.active {
  border-color: var(--primary-color);
  transform: translateY(-4px);
}

.foto-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.foto-thumb .foto-thumb-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(229, 35, 41, 0.9);
  color: #fff;
  border: none;
  font-size: 16px;
  line-height: 24px;
  text-align: center;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 2;
}

.foto-empty {
  color: var(--secondary-color);
  font-size: 13px;
}

.ticket-file-input {
  margin-top: 15px;
  width: 100%;
}

.btn-icon-camera {
  background: none;
  border: none;
  color: var(--primary-color);
  cursor: pointer;
  padding: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  border-radius: 50%;
}

.btn-icon-camera:active {
  transform: scale(0.95);
}

.btn-icon-camera svg {
  display: block;
}

.image-preview-container {
  width: 100%;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-preview-container img {
  width: 100%;
  height: auto;
  display: block;
}

.modal-footer .btn {
  min-width: 150px;
}

/* Overlay blur para modal de procesamiento */
.modal-processing-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  flex-direction: column;
  gap: 20px;
}

.modal-processing-overlay.active {
  display: flex;
}

.processing-spinner {
  width: 60px;
  height: 60px;
  border: 4px solid rgba(229, 35, 41, 0.2);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.processing-text {
  font-size: 16px;
  font-weight: 600;
  color: var(--dark-color);
  text-align: center;
  max-width: 300px;
  line-height: 1.4;
}

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

/* Modal de resultados */
.results-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1100;
  justify-content: center;
  align-items: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.results-modal.active {
  display: flex;
  opacity: 1;
}

.results-content {
  background: white;
  border-radius: 16px;
  max-width: 600px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.4s ease;
}

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

.results-header {
  padding: 24px 28px;
  border-bottom: 2px solid #f0f0f0;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.results-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(40, 167, 69, 0.15);
  color: var(--success-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  flex-shrink: 0;
}

.results-title-group h3 {
  margin: 0 0 4px;
  font-size: 20px;
  color: var(--dark-color);
}

.results-subtitle {
  margin: 0;
  font-size: 14px;
  color: var(--secondary-color);
}

.results-body {
  padding: 20px 28px;
  overflow-y: auto;
  flex: 1 1 auto;
}

.result-item {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 14px;
  border-left: 4px solid var(--primary-color);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.result-item:hover {
  transform: translateX(4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.result-item:last-child {
  margin-bottom: 0;
}

.result-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 12px;
}

.result-codigo {
  font-size: 16px;
  font-weight: 700;
  color: var(--dark-color);
}

.result-details {
  display: grid;
  gap: 8px;
}

.result-detail-row {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 12px;
  font-size: 14px;
  align-items: start;
}

.result-detail-row-full {
  grid-template-columns: 1fr;
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid #e0e0e0;
}

.result-detail-label {
  font-weight: 600;
  color: var(--secondary-color);
  font-size: 13px;
}

.result-detail-value {
  color: var(--dark-color);
  word-break: break-word;
}

.result-input {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  transition: all 0.3s ease;
  margin-top: 6px;
}

.result-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(229, 35, 41, 0.1);
}

.result-input::placeholder {
  color: #999;
  font-style: italic;
}

.results-footer {
  padding: 20px 28px;
  border-top: 2px solid #f0f0f0;
  display: flex;
  justify-content: center;
  flex-shrink: 0;
}

.results-footer .btn {
  min-width: 180px;
}

.modal-header {
  padding: 20px 25px;
  border-bottom: 2px solid #f0f0f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.modal-header h3 {
  margin: 0;
  color: var(--dark-color);
}

.close-modal {
  background: none;
  border: none;
  font-size: 28px;
  color: var(--secondary-color);
  cursor: pointer;
  line-height: 1;
}

.modal-body {
  padding: 25px;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
}

.form-group textarea {
  width: 100%;
  padding: 12px 15px;
  border: 2px solid #e0e0e0;
  border-radius: var(--border-radius);
  font-size: 16px;
  font-family: inherit;
  resize: vertical;
  min-height: 100px;
}

.form-group textarea:focus {
  outline: none;
  border-color: var(--primary-color);
}

.modal-footer {
  padding: 20px 25px;
  border-top: 2px solid #f0f0f0;
  display: flex;
  gap: 10px;
  flex-shrink: 0;
  background: white;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.estado-selector {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.estado-btn {
  padding: 8px 16px;
  border: 2px solid #e0e0e0;
  background: white;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: var(--transition);
}

.estado-btn.active {
  border-color: var(--primary-color);
  background: var(--primary-color);
  color: white;
}

.resultado-selector {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.resultado-btn {
  padding: 8px 16px;
  border: 2px solid #e0e0e0;
  background: white;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: var(--transition);
}

.resultado-btn.active {
  border-color: var(--primary-color);
  background: var(--primary-color);
  color: white;
}

.resultado-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.historial-estados {
  margin-top: 20px;
}

.historial-item {
  padding: 15px;
  background: var(--light-color);
  border-radius: var(--border-radius);
  margin-bottom: 10px;
  border-left: 4px solid var(--primary-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
}

.historial-info {
  flex: 1;
}

.historial-actions {
  display: flex;
  gap: 5px;
  flex-shrink: 0;
}

.historial-item .fecha {
  font-size: 12px;
  color: var(--secondary-color);
  margin-top: 5px;
}

.historial-item .usuario {
  font-size: 12px;
  color: var(--secondary-color);
  font-style: italic;
  margin-top: 3px;
}

.loading {
  text-align: center;
  padding: 40px;
  color: var(--secondary-color);
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--secondary-color);
}

.empty-state h3 {
  margin-bottom: 10px;
}

/* Responsive */
@media (max-width: 1024px) {
  .navbar {
    padding: 15px 20px;
  }

  .container {
    padding: 0 20px 20px;
  }

  .table-header {
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
  }
}

@media (max-width: 768px) {
  .navbar {
    flex-direction: column;
    gap: 15px;
    align-items: flex-start;
  }

  .navbar-user {
    width: 100%;
    justify-content: space-between;
  }

  .container {
    padding: 0 16px 20px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .stat-card {
    padding: 16px 12px;
  }

  .stat-card .number {
    font-size: 28px;
    margin-bottom: 3px;
  }

  .stat-card .label {
    font-size: 11px;
    letter-spacing: 0.5px;
  }

  .filters {
    flex-direction: column;
  }

  .filters input,
  .filters select {
    width: 100%;
  }

  .table-header {
    padding: 16px;
  }

  .table-container {
    box-shadow: none;
    background: none;
  }

  .reparaciones-table {
    background: none;
  }

  tbody td {
    padding: 12px 15px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .modal {
    padding: 10px;
    align-items: flex-start;
  }

  .modal-content {
    max-width: 100%;
    height: 100%;
    border-radius: 16px;
    box-shadow: none;
  }

  .modal-body {
    padding: 18px;
  }

  .modal-header,
  .modal-footer {
    padding: 16px 18px;
  }

  .modal-footer .btn {
    width: 100%;
    min-width: 0;
  }

  .historial-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .historial-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .login-box {
    padding: 30px 24px;
  }
}

@media (max-width: 640px) {
  .navbar-user {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .filters {
    padding: 16px;
  }

  .reparaciones-table,
  .reparaciones-table thead,
  .reparaciones-table tbody,
  .reparaciones-table th,
  .reparaciones-table td,
  .reparaciones-table tr {
    display: block;
  }

  .reparaciones-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .reparaciones-table tbody {
    display: flex;
    flex-direction: column;
    gap: 15px;
  }

.reparaciones-table tbody tr {
  background: white;
  border-radius: 16px;
  padding: 16px 18px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
  border: 1px solid #eef1f4;
}

.reparaciones-table tbody td {
  border: none;
    padding: 8px 0;
    display: block;
  }

  .reparaciones-table tbody td::before {
    content: attr(data-label);
    display: block;
    font-weight: 600;
    color: var(--secondary-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 10px;
    margin-bottom: 4px;
  }

  .reparaciones-table tbody td[data-label="Código"] strong {
    font-size: 16px;
    font-weight: 700;
    color: var(--dark-color);
  }

  /* Contenedor de badges en móvil */
  .reparaciones-table .badges-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
  }

  .btn-marcar-gestionado {
    margin-left: 0;
    margin-top: 8px;
    width: 100%;
  }


  .modal-content {
    border-radius: 12px;
  }

  .modal-footer .btn {
    width: 100%;
  }

  .feedback-card {
    width: calc(100% - 32px);
    padding: 20px 60px 20px 20px;
  }

  .confirm-card {
    width: calc(100% - 32px);
    padding: 24px;
  }

  .results-content {
    max-width: 100%;
    border-radius: 12px;
  }

  .results-header {
    padding: 20px;
  }

  .results-body {
    padding: 16px 20px;
  }

  .results-footer {
    padding: 16px 20px;
  }

  .results-footer .btn {
    min-width: 0;
    width: 100%;
  }

  .result-detail-row {
    grid-template-columns: 90px 1fr;
  }
}

@media (max-width: 480px) {
  body {
    font-size: 15px;
  }

  .navbar-brand h2 {
    font-size: 18px;
  }

  .filters {
    gap: 12px;
  }

  .filters input,
  .filters select {
    min-width: 0;
  }

  .modal-header h3 {
    font-size: 18px;
  }

  .modal-body {
    padding: 16px;
  }

  .modal-header,
  .modal-footer {
    padding: 14px 16px;
  }

  .historial-item {
    gap: 10px;
  }
}

/* Animaciones */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes feedback-pop {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal.active .modal-content {
  animation: fadeIn 0.3s ease;
}

/* Checkbox personalizado para piezas pedidas */
.piezas-cell {
  text-align: center;
}

.checkbox-container {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  user-select: none;
  width: 32px;
  height: 32px;
}

.checkbox-container input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  width: 0;
  height: 0;
}

.checkmark {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  height: 24px;
  width: 24px;
  background-color: #ffffff;
  border: 2px solid #d0d0d0;
  border-radius: 6px;
  transition: all 0.25s ease;
}

.checkbox-container:hover .checkmark {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(229, 35, 41, 0.1);
}

.checkbox-container input:checked ~ .checkmark {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

.checkmark:after {
  content: "";
  position: absolute;
  display: none;
  left: 7px;
  top: 3px;
  width: 6px;
  height: 11px;
  border: solid white;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}

.checkbox-container input:checked ~ .checkmark:after {
  display: block;
}

.checkbox-container input:disabled ~ .checkmark {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Scrollbar personalizada */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* Grupos de duplicados */
.duplicate-group-odd {
  background-color: #fff9fa !important; /* Tinte rojo muy suave */
  border-left: 3px solid var(--primary-color);
}

.duplicate-group-even {
  background-color: #f0f8ff !important; /* Tinte azul muy suave */
  border-left: 3px solid var(--info-color);
}

.duplicate-group-odd:hover, 
.duplicate-group-even:hover {
  background-color: #ececec !important; /* Unificar hover */
}

.btn-ocultar-grupo {
  padding: 2px 8px;
  font-size: 11px;
  background-color: #6c757d;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  margin-left: 8px;
  vertical-align: middle;
  transition: background-color 0.2s;
}

.btn-ocultar-grupo:hover {
  background-color: #5a6268;
}

.duplicate-group-hidden {
  opacity: 0.5;
  background-color: #f0f0f0 !important;
  border-left-color: #ccc !important;
}
