/* cards.css - Estilos card de carga */
.card {
  background: var(--bg-primary);
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
  margin-bottom: 4px;
  overflow: hidden;
  border: 1px solid #E0E0E0;
}

.card.gestionada { background: var(--bg-secondary); }

/* Banner accion requerida */
.card-banner {
  padding: 4px 10px;
  color: white;
  font-size: 11px;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 6px;
}

.card-banner-critico { background: var(--banner-critico); }
.card-banner-alto { background: var(--banner-alto); }
.card-banner-medio { background: var(--banner-medio); }

/* Cuerpo card */
.card-body {
  padding: 5px 8px;
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.card-checkbox {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.card-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.card-info { flex: 1; min-width: 0; }

.card-menu {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  font-size: 14px;
  cursor: pointer;
  color: var(--text-secondary);
}

/* Linea 1: codCar + fase + estado + tiempo */
.card-titulo {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 1px;
  flex-wrap: nowrap;
}

.card-codcar {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  font-weight: bold;
  color: var(--text-primary);
}

.card-transportista {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 1px;
}

.chip-estado {
  font-size: 11px;
  line-height: 1;
}

/* Linea asunto */
.card-asunto {
  font-size: 12px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

/* Linea preview ultimo mensaje */
.card-preview {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.chip-fase {
  display: inline-flex;
  align-items: center;
  padding: 1px 5px;
  border-radius: 8px;
  font-size: 9px;
  font-weight: 600;
  color: white;
}

.chip-fase-default { background: var(--color-fase-default); }
.chip-fase-ok { background: var(--color-fase-ok); }
.chip-fase-incidencia { background: var(--color-fase-incidencia); }

.card-tiempo {
  font-size: 9px;
  color: var(--text-secondary);
  margin-left: auto;
}

/* Botones de accion en card */
.card-acciones {
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid #F0F0F0;
}

.card-acciones .btn {
  padding: 8px 16px;
  font-size: 13px;
  min-height: 40px;
}

/* Detalle */
.detalle-header {
  position: sticky;
  top: 0;
  background: var(--color-primary);
  color: white;
  padding: 12px 16px;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 12px;
}

.detalle-back {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
}

.detalle-titulo {
  flex: 1;
  font-size: 18px;
  font-weight: bold;
}

/* Email en hilo */
.email-item {
  padding: 12px;
  border-bottom: 1px solid #F0F0F0;
}

.email-remitente {
  font-weight: bold;
  font-size: 14px;
}

.email-fecha {
  font-size: 12px;
  color: var(--text-secondary);
}

.email-cuerpo {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Nota en lista */
.nota-item {
  padding: 12px;
  border-bottom: 1px solid #F0F0F0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.nota-texto { flex: 1; font-size: 14px; }

.nota-fecha {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.nota-eliminar {
  color: var(--color-danger);
  background: transparent;
  border: none;
  font-size: 18px;
  min-width: 48px;
  min-height: 48px;
  cursor: pointer;
}

/* Editor respuesta */
.editor-overlay {
  position: fixed;
  inset: 0;
  background: white;
  z-index: 300;
  display: flex;
  flex-direction: column;
}

.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #E0E0E0;
}

.editor-cerrar {
  min-width: 48px;
  min-height: 48px;
  background: transparent;
  border: none;
  font-size: 24px;
  cursor: pointer;
}

.editor-cuerpo {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
}

.editor-cuerpo textarea {
  width: 100%;
  min-height: 200px;
  border: 1px solid #E0E0E0;
  border-radius: var(--radius);
  padding: 12px;
  font-size: 16px;
  font-family: inherit;
  resize: vertical;
}

.editor-pie {
  padding: 12px 16px;
  background: var(--bg-secondary);
  font-size: 13px;
  color: var(--text-secondary);
  border-top: 1px solid #E0E0E0;
}

.editor-acciones {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Resumen matutino modal */
.resumen-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 250;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.resumen-panel {
  background: white;
  border-radius: var(--radius);
  width: 100%;
  max-width: 400px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
}

.resumen-titulo {
  font-size: 20px;
  font-weight: bold;
  margin-bottom: 16px;
  text-align: center;
}

.resumen-tarjeta {
  padding: 12px;
  border-radius: var(--radius);
  margin-bottom: 12px;
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 56px;
  cursor: pointer;
}

.resumen-tarjeta-urgente { background: var(--cat-urgente); }
.resumen-tarjeta-sinrespuesta { background: var(--cat-sin-respuesta); }
.resumen-tarjeta-docs { background: var(--cat-documentacion); }
.resumen-tarjeta-estancadas { background: var(--cat-estancadas); }

.resumen-conteo {
  font-size: 24px;
  font-weight: bold;
}

/* Ficha detalle */
.detalle-ficha {
  background: var(--bg-primary);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 8px;
  box-shadow: var(--shadow);
}

.ficha-fila {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  border-bottom: 1px solid #F5F5F5;
  font-size: 13px;
}

.ficha-fila:last-child { border-bottom: none; }

.ficha-fila-badges {
  flex-wrap: wrap;
  padding: 6px 0;
  gap: 8px;
}

.ficha-icono {
  width: 20px;
  text-align: center;
  flex-shrink: 0;
  font-size: 14px;
}

.ficha-label {
  color: var(--text-secondary);
  font-size: 12px;
  min-width: 80px;
  flex-shrink: 0;
}

.ficha-valor {
  flex: 1;
  font-weight: 500;
  word-break: break-word;
}

.ficha-estado {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
  background: var(--bg-secondary);
}

.ficha-estado-enviado { background: #E3F2FD; color: #1565C0; }
.ficha-estado-recibido { background: #FFF3E0; color: #E65100; }
.ficha-estado-gestionado { background: #E8F5E9; color: #2E7D32; }
.ficha-estado-alerta { background: #FFEBEE; color: #C62828; }

/* Cuerpo email expandible */
.detalle-cuerpo-email {
  background: var(--bg-primary);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 8px;
  box-shadow: var(--shadow);
}

.cuerpo-texto {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
}

.cuerpo-texto.truncado {
  max-height: 80px;
  overflow: hidden;
  position: relative;
}

.cuerpo-texto.truncado::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 30px;
  background: linear-gradient(transparent, white);
}

.btn-ver-mas {
  background: transparent;
  border: none;
  color: var(--color-primary);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 0;
  cursor: pointer;
}
